Method: Object#public_send

Defined in:
vm_eval.c

#public_send(symbol[, args...]) ⇒ Object #public_send(string[, args...]) ⇒ Object

Invokes the method identified by symbol, passing it any arguments specified. Unlike send, public_send calls public methods only. When the method is identified by a string, the string is converted to a symbol.

1.public_send(:puts, "hello")  # causes NoMethodError

Overloads:

  • #public_send(symbol[, args...]) ⇒ Object

    Returns:

  • #public_send(string[, args...]) ⇒ Object

    Returns:



928
929
930
931
932
# File 'vm_eval.c', line 928

VALUE
rb_f_public_send(int argc, VALUE *argv, VALUE recv)
{
    return send_internal(argc, argv, recv, CALL_PUBLIC);
}