From: Stu Date: 2013-05-18T05:37:18+09:00 Subject: Re: how to create a method object of from an singleton method? Not sure if the ruby docs aren't clear enough. Look into define_method, class_eval and instance_eval. It will be one of those or higher ordered scoped where singleton_ is before them. Of course you can always user eval primitive or monkey patch it all the same. ~Stu On Fri, May 17, 2013 at 2:42 PM, Love U Ruby wrote: > class Foo > def suprim;end > end > > p foo = Foo.new #=> # > p foo.method(:suprim) #=> # > p Bar=foo.singleton_class #=> #> > p foo.define_singleton_method(:hello) { "#{self}: Hello there!" } #=> > # > p Bar.method(:hello) #=> `method': undefined method `hello' for class > `Class' (NameError) > > My question is how to create a method object of an singleton method,like > I did `foo.method(:suprim)`? > > -- > Posted via http://www.ruby-forum.com/. >