Class: ObjectIdentifier::StringFormatter::SingleObject

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

Overview

ObjectIdentifier::StringFormatter::SingleObject formats a single-object-specific identification String.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, parameters) ⇒ SingleObject

Returns a new instance of SingleObject.

Parameters:



103
104
105
106
# File 'lib/object_identifier/formatters/string_formatter.rb', line 103

def initialize(object, parameters)
  @object = object
  @parameters = parameters
end

Class Method Details

.call(*args) ⇒ String

Returns the self-identifying String for the passed in object.

Returns:

  • (String)

    the self-identifying String for the passed in object.



96
97
98
# File 'lib/object_identifier/formatters/string_formatter.rb', line 96

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

Instance Method Details

#callString

Returns the self-identifying String for @object.

Returns:

  • (String)

    the self-identifying String for @object.



109
110
111
112
113
# File 'lib/object_identifier/formatters/string_formatter.rb', line 109

def call
  return NO_OBJECTS_INDICATOR if blank?

  "#{class_name}[#{formatted_attributes}]"
end