1 2 3 4 5 6 7 |
class Person def my_name “Diana" end end diana = Person.new |
-
(Single run time) Using dot notation and calling the method on the object:
1diana.my_name - (Persist name of method to database) Using send method:
1diana.send(:my_name) -
Get the method and call it like a Proc:
1diana.method(:my_name).call -
Not good practice but useful sometimes. (Self-modifying method code):
1eval “diana.my_name"