Class: ObjectIdentifier::BaseFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/object_identifier/formatters/base_formatter.rb

Overview

ObjectIdentifier::BaseFormatter is an abstract base class for formatters.

Direct Known Subclasses

StringFormatter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(objects, parameters: ObjectIdentifier::Parameters.build) ⇒ BaseFormatter

Returns a new instance of BaseFormatter.

Parameters:

  • objects (Object, [Object, ...])

    The object(s) to be interrogated for String values to be added to the output String.

  • parameters (ObjectIdentifier::Parameters) (defaults to: ObjectIdentifier::Parameters.build)


16
17
18
19
# File 'lib/object_identifier/formatters/base_formatter.rb', line 16

def initialize(objects, parameters: ObjectIdentifier::Parameters.build)
  @objects = ObjectIdentifier::ArrayWrap.(objects)
  @parameters = parameters
end

Instance Attribute Details

#objectsObject (readonly)

Returns the value of attribute objects.



5
6
7
# File 'lib/object_identifier/formatters/base_formatter.rb', line 5

def objects
  @objects
end

#parametersObject (readonly)

Returns the value of attribute parameters.



5
6
7
# File 'lib/object_identifier/formatters/base_formatter.rb', line 5

def parameters
  @parameters
end

Class Method Details

.callObject

A shortcut for calling ‘new(…).call`.



9
10
11
# File 'lib/object_identifier/formatters/base_formatter.rb', line 9

def self.call(...)
  new(...).call
end

Instance Method Details

#callObject

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/object_identifier/formatters/base_formatter.rb', line 21

def call
  raise NotImplementedError
end