From: Tamara Temple Date: 2013-07-23T22:29:41+09:00 Subject: Re: How can we create instance method and class methods at runtime in ruby? On Jul 23, 2013, at 6:18 AM, Love U Ruby wrote: > Stefano Crocco wrote in post #1116318: >> On Tuesday 23 July 2013 Love U Ruby wrote >> >> Foo.class_eval do >> define_method(:test){p 'hello'} >> end >> >> or you can use send: >> >> Foo.send :define_method, :test, &proc{p 'hello'} >> >> I hope this helps >> >> Stefano > > Thanks @Stefano - this is what I was looking for.. :) > > -- > Posted via http://www.ruby-forum.com/. > Be circumspect in doing this with define_method. It's a lot slower when you call the method: https://gist.github.com/tribalvibes/1123584