#2 楼 @jjym
试了一下 self 的单件方法。
irb 中的
1.9.3-p194 :005 > self.singleton_methods false
=> [:to_s, :public, :private, :include, :context, :conf, :irb_quit, :exit, :quit, :irb_print_working_workspace, :irb_cwws, :irb_pwws, :cwws, :pwws, :irb_current_working_binding, :irb_print_working_binding, :irb_cwb, :irb_pwb, :irb_chws, :irb_cws, :chws, :cws, :irb_change_binding, :irb_cb, :cb, :workspaces, :irb_bindings, :bindings, :irb_pushws, :pushws, :irb_push_binding, :irb_pushb, :pushb, :irb_popws, :popws, :irb_pop_binding, :irb_popb, :popb, :source, :jobs, :fg, :kill, :help]
1.9.3-p194 :006 > obj=Object.new
=> #<Object:0x00000000a735a0>
1.9.3-p194 :007 > obj.singleton_methods false
=> []
同样的语句在文本中也试了一下
self.singleton_methods false #-> [:to_s, :public, :private, :include]
Object.new.singleton_methods false #-> []
求权威解释