Method: Module#singleton_method_defined?

Defined in:
lib/core/facets/module/instance_method_defined.rb

#singleton_method_defined?(meth) ⇒ Boolean Also known as: module_method_defined?, class_method_defined?

Query whether a normal (singleton) method is defined for the module.

CREDIT: Gavin Sinclair, Noah Gibbs

Returns:

  • (Boolean)


15
16
17
# File 'lib/core/facets/module/instance_method_defined.rb', line 15

def singleton_method_defined?(meth)
  singleton_methods(true).find{ |m| m.to_sym == meth.to_sym }
end