Calling Ruby methods various ways.
Calling methods for a object other than dot operator
.
Sample class:
- Using
dot operator
(Normally used).
- Using
send
method.
- Using
method(:method_name).call
.
- The major difference between
dot
,send
andmethod(:name).call
is last two will call the private, protected methods as well.
Happy Coding :)
Written on April 24, 2015Share in your circles :)