Monday, September 22, 2008

Three ways to invoke a method in ruby

1. object = Object.new
puts object.object_id
#=> 282660

2. puts object.send(:object_id)
#=> 282660

3. puts object.method(:object_id).call
#=> 282660

No comments: