Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Object#public_send

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