Sha256: 3cf4863ca1b46352603d69146a1762479dcf6aebef631829a08bbd9924cfbf25

Contents?: true

Size: 778 Bytes

Versions: 7

Compression:

Stored size: 778 Bytes

Contents

class Module

  # List all instance_methods, equivalent to
  #
  #   public_instance_methods +
  #   protected_instance_methods +
  #   private_instance_methods

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

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

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

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

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

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
facets-2.1.2 lib/core/facets/module/methods.rb
facets-2.0.3 lib/core/facets/module/methods.rb
facets-2.0.4 lib/core/facets/module/methods.rb
facets-2.0.5 lib/core/facets/module/methods.rb
facets-2.1.0 lib/core/facets/module/methods.rb
facets-2.1.1 lib/core/facets/module/methods.rb
facets-2.1.3 lib/core/facets/module/methods.rb