Hacker News new | past | comments | ask | show | jobs | submit login

    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



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: