反射(后期绑定)

class MacBook
     attr_reader :year, :version

    def initialize(year, version)    
        @year = year
        @version = version
    end

    def show_info() 
        puts "year = #{@year}, " + 
             "version = #{@version}"
    end
end

puts Object.const_get("MacBook")
    .instance_methods(false)
# prints:
#   year
#   version
#   show_info