Method_exists? is missing?


#1

In a controller run through webrick I do this:

@entity = Entity.new
print @entity.methods.sort.to_yaml

and I see this:

  • logger
  • mark_for_destruction
  • marked_for_destruction?
  • metaclass
  • method
  • method_missing
  • methods
  • new_record?

There is no method_exists? method. If I instead do this in a console
session, I see this:

$ script/console

@entity = Entity.new
=> …

print @entity.methods.sort.to_yaml

  • logger
  • mark_for_destruction
  • marked_for_destruction?
  • metaclass
  • method
  • method_exists?
  • method_missing
  • methods
  • mocha
  • mocha_inspect
  • new_record?

However, if I remove the mocha gem (0.9.5) then method_exists?
disappears from Entities created in the console as well.

So, what gives?


#2

James B. wrote:

So, what gives?

Turns out I should be using #respond-_to? instead. Method_missing? is
part of mocha.