method
send
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
send(*args)
public
Invokes the method identified by symbol, passing it any arguments specified. You can use __send__ if the name send clashes with an existing method in obj. When the method is identified by a string, the string is converted to a symbol.
class Klass def hello(*args) "Hello " + args.join(' ') end end k = Klass.new k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
Register or
log in
to add new notes.
ibnukamy -
February 4, 2014 - (v1_9_3_392)
![Default_avatar_30](https://www.gravatar.com/avatar/6f86f5c0b1db708711efdedf74f6f957?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
Alternative to :symbol
You can also pass string as an alternative to :symbol
k = Klass.new
k.send “hello”, “gentle”, “readers” #=> “Hello gentle readers”