LoginSignup
1

More than 5 years have passed since last update.

method_missingの中でmethod_missing

Last updated at Posted at 2012-03-07

okinawa.rbにてちょっと話題に出たので検証。

method_missingの中で知らないメソッドを問い合わせしてmethod_missingを呼び出すと、無限ループになるの?

class Hoge
  def method_missing(method, *args)
    puts "call #{method} is missing"
    self.moge
  end
end

x = Hoge.new

無限ループになりました。stack level too deepで死にます。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1