Re:Ruby 2.1.0 preview1 released
by lectrick on Monday September 23, 2013 @08:54AM
(#6430465)
How about method(:methodname) returning the actual method object instead of a newly instantiated wrapper class containing the method metadata?
[ Parent
| on HN ]
irb(main):001:0> RUBY_VERSION
=> "2.0.0"
irb(main):002:0> class Foo; def hello; puts "hello"; end; end
=> nil
irb(main):003:0> X = Foo.new.method(:hello)
=> #<Method: Foo#hello>
irb(main):004:0> X.class
=> Method
irb(main):005:0> class Bar; define_method(:hello, &X); end
=> #<Proc:0x007f93d087a2d8 (lambda)>
irb(main):006:0> Bar.new.hello
hello
=> nil