Method: Object#send
- Defined in:
- vm_eval.c
#send(symbol[, args...]) ⇒ Object #__send__(symbol[, args...]) ⇒ Object #send(string[, args...]) ⇒ Object #__send__(string[, args...]) ⇒ Object
Invokes the method identified by symbol, passing it any
arguments specified. You can use <code>__send__</code> 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.
BasicObject implements +__send__+, Kernel implements +send+.
class Klass
def hello(*args)
"Hello " + args.join(' ')
end
end
k = Klass.new
k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
1187 1188 1189 1190 1191 |
# File 'vm_eval.c', line 1187
VALUE
rb_f_send(int argc, VALUE *argv, VALUE recv)
{
return send_internal_kw(argc, argv, recv, CALL_FCALL);
}
|