Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/extensions/_base.rb

Overview

For what reason does Ruby define Module#methods, Module#instance_methods, and Module#method_defined?, but not Module#instance_method_defined? ?

No matter, extending standard classes is the name of the game here.

Instance Method Summary collapse

Instance Method Details

#instance_method_defined?(_method) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/extensions/_base.rb', line 53

def instance_method_defined?(_method)
  instance_methods(true).find { |m| m == _method.to_s }
end

#module_method_defined?(_method) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/extensions/_base.rb', line 61

def module_method_defined?(_method)
  singleton_methods(true).find { |m| m == _method.to_s }
end