InterviewSolution
Saved Bookmarks
| 1. |
There Are Three Ways To Invoke A Method In Ruby. Can You Give Me At Least Two? Here, I’m Looking For The Dot Operator (or Period Operator), The Object#send Method, Or Method(:foo).call? |
|
Answer» object = Object.new PUTS object.object_id #=> 282660 puts object.send(:object_id) #=> 282660 puts object.method(:object_id).CALL # (Kudos to EZRA) #=> 282660 object = Object.new puts object.object_id #=> 282660 puts object.send(:object_id) #=> 282660 puts object.method(:object_id).call # (Kudos to Ezra) #=> 282660 |
|