-4
o = Object.new

def o.method_missing(m,*args)
  puts "xxxxxxx #{m}"
end

p o.some_method

What is the underlying process of overriding a method?

Mor Haham
  • 49
  • 1
  • 8

1 Answers1

2

how does the new method know that I am calling a missing method

If a called method is not defined, it can tell that you are calling a missing method.

how does it print the output of the new method?

By executing the new defined method.

How is some_method considered as the m argument?

By design.

sawa
  • 165,429
  • 45
  • 277
  • 381