I think this is what you’re looking for:
class Test
define_method :test do |&b|
b.call
end
end
Test.new.test {
puts "Hi!"
}
More at http://coderrr.wordpress.com/2008/10/29/using-define_method-with-blocks-in-ruby-18/
I think this is what you’re looking for:
class Test
define_method :test do |&b|
b.call
end
end
Test.new.test {
puts "Hi!"
}
More at http://coderrr.wordpress.com/2008/10/29/using-define_method-with-blocks-in-ruby-18/