Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

NoMethodError.new

NoMethodError.new(msg=nil, name=nil, args=nil, private=false, receiver: nil) → no_method_error

Construct a NoMethodError exception for a method of the given name called with the given arguments. The name may be accessed using the name method on the resulting object, and the arguments using the args method.

If private argument were passed, it designates method was attempted to call in private context, and can be accessed with private_call? method.

receiver argument stores an object whose method was called.

See also #args #private_call? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1