Explain method missing?

If you call a method that doesn’t exist, Ruby calls method_missing.
You can override it to handle undefined methods.

class MyClass
  def method_missing(name, *args)
puts "Method #{name} is missing!"
end end obj = MyClass.new obj.hello #

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *