Sha256: 10bcf82880f10c9b89fb49f79f8b0273ed4649fe44841abfc8797e5251f6d569

Contents?: true

Size: 604 Bytes

Versions: 10

Compression:

Stored size: 604 Bytes

Contents

class Module

  # Query whether a public instance method is defined for the module.
  #
  # CREDIT: Gavin Sinclair, Noah Gibbs

  def instance_method_defined?(meth)
    instance_methods(true).find{ |m| m.to_sym == meth.to_sym }
  end

  # Query whether a normal (singleton) method is defined for the module.
  #
  # CREDIT: Gavin Sinclair, Noah Gibbs

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

  #
  alias_method :module_method_defined?, :singleton_method_defined?
  alias_method :class_method_defined?,  :singleton_method_defined?

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/module/instance_method_defined.rb
facets-3.1.0 lib/core/facets/module/instance_method_defined.rb
facets-3.0.0 lib/core/facets/module/instance_method_defined.rb
facets-2.9.3 lib/core/facets/module/instance_method_defined.rb
facets-2.9.2 src/core/facets/module/instance_method_defined.rb
facets-2.9.2 lib/core/facets/module/instance_method_defined.rb
facets-2.9.1 lib/core/facets/module/instance_method_defined.rb
facets-2.9.0 lib/core/facets/module/instance_method_defined.rb
facets-2.9.0.pre.2 lib/core/facets/module/instance_method_defined.rb
facets-2.9.0.pre.1 lib/core/facets/module/instance_method_defined.rb