Skip to content
instance method

Object#public_send

(::interned name, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
obj.public_send(symbol [, args...]) → obj
obj.public_send(string [, args...]) → obj

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.

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