Sha256: 513cd2a3d92fab84a1b3eb35b9da082d7ef71b11640f250ec665eb62a6410a80

Contents?: true

Size: 834 Bytes

Versions: 3

Compression:

Stored size: 834 Bytes

Contents

class Module

  # List all instance_methods, equivalent to
  #
  #   public_instance_methods +
  #   protected_instance_methods +
  #   private_instance_methods
  #
  #   CREDIT: Trans

  def all_instance_methods(include_super=true)
    public_instance_methods(include_super) +
    protected_instance_methods(include_super) +
    private_instance_methods(include_super)
  end

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


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

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

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.2.0 lib/core/facets/module/methods.rb
facets-2.2.1 lib/core/facets/module/methods.rb
facets-2.3.0 lib/core/facets/module/methods.rb