Friday, January 29, 2010

A small Tip

A small tip to call methods dynamically using Ruby's send method.

["foo", "bar"].each do |method|
MyClass.send(method)
end

The above code is same as calling MyClass.foo and MyClass.bar.

No comments: