Module: ObjectIdentifier

Defined in:
lib/object_identifier.rb,
lib/object_identifier/version.rb,
lib/object_identifier/configuration.rb,
lib/object_identifier/object_identifier.rb

Overview

ObjectIdentifier is the top-level namespace/module for this gem.

Defined Under Namespace

Modules: ArrayWrap Classes: BaseFormatter, Configuration, Parameters, StringFormatter

Constant Summary collapse

VERSION =

The current ObjectIdentifier gem version.

"0.9.0"

Class Method Summary collapse

Class Method Details

.call(objects, *attributes, formatter_class: default_formatter_class, **formatter_options) ⇒ Object

ObjectIdentifier.call is the main entry point for use of this gem. In typical usage, however, this method will almost exclusively just be called by Object#identify, as defined in lib/core_ext/object.rb.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/object_identifier/object_identifier.rb', line 10

def self.call(
      objects,
      *attributes,
      formatter_class: default_formatter_class,
      **formatter_options)

  parameters =
    ObjectIdentifier::Parameters.build(
      attributes: attributes,
      formatter_options: formatter_options)

  formatter_class.(objects, parameters: parameters)
end

.configurationObject

Accessor for the Configuration object.



20
21
22
# File 'lib/object_identifier/configuration.rb', line 20

def self.configuration
  @configuration ||= ObjectIdentifier::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yield Parameters:



25
26
27
# File 'lib/object_identifier/configuration.rb', line 25

def self.configure
  yield(configuration)
end

.default_attributesObject

The default attributes to include on object inspections.



13
14
15
# File 'lib/object_identifier/configuration.rb', line 13

def self.default_attributes
  configuration.default_attributes
end

.default_formatter_classObject

The default formatter class to use (StringFormatter).



8
9
10
# File 'lib/object_identifier/configuration.rb', line 8

def self.default_formatter_class
  configuration.formatter_class
end

.reset_configurationObject

Reset the current configuration settings memoized by configuration.



31
32
33
# File 'lib/object_identifier/configuration.rb', line 31

def self.reset_configuration
  @configuration = ObjectIdentifier::Configuration.new
end