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(' ')
k =
k.send :hello, "gentle", "readers"   #=> "Hello gentle readers"
Show source
Register or log in to add new notes.
February 4, 2014 - (v1_9_3_392)
0 thanks

Alternative to :symbol

You can also pass string as an alternative to :symbol

k =

k.send “hello”, “gentle”, “readers” #=> “Hello gentle readers”