Module: ObjectIdentifier
- Defined in:
- lib/object_identifier.rb,
lib/object_identifier/version.rb
Overview
ObjectIdentifier is the base namespace for all modules/classes related to the object_identifier gem.
Defined Under Namespace
Classes: ArrayWrap, Configuration, Parameters, StringFormatter
Constant Summary
collapse
- VERSION =
"0.6.0"
Class Method Summary
collapse
Class Method Details
.buid_parameters(attributes: [], formatter_options: {}) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/object_identifier.rb', line 25
def self.buid_parameters(attributes: [], formatter_options: {})
attrs = ObjectIdentifier::ArrayWrap.(attributes)
attrs = default_attributes if attrs.empty?
attrs.flatten!
Parameters.new(
attributes: attrs,
formatter_options: formatter_options.to_h)
end
|
.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. :reek:LongParameterList
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/object_identifier.rb', line 10
def self.call(
objects,
*attributes,
formatter_class: default_formatter_class,
**formatter_options)
parameters =
buid_parameters(
attributes: attributes,
formatter_options: formatter_options)
formatter_class.(objects, parameters)
end
|
.configuration ⇒ Object
43
44
45
|
# File 'lib/object_identifier.rb', line 43
def self.configuration
@configuration ||= Configuration.new
end
|
47
48
49
|
# File 'lib/object_identifier.rb', line 47
def self.configure
yield(configuration)
end
|
.default_attributes ⇒ Object
39
40
41
|
# File 'lib/object_identifier.rb', line 39
def self.default_attributes
configuration.default_attributes
end
|
35
36
37
|
# File 'lib/object_identifier.rb', line 35
def self.default_formatter_class
configuration.formatter_class
end
|
.reset_configuration ⇒ Object
51
52
53
|
# File 'lib/object_identifier.rb', line 51
def self.reset_configuration
@configuration = Configuration.new
end
|