Class: ObjectIdentifier::StringFormatter::Collection
- Defined in:
- lib/object_identifier/formatters/string_formatter.rb
Overview
ObjectIdentifier::StringFormatter::Collection formats a collection-specific identification String, which will also necessarily be composed of SingleObject identification Strings.
Class Method Summary collapse
-
.call(*args) ⇒ String
The self-identifying String for the passed in object.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(objects, parameters) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(objects, parameters) ⇒ Collection
Returns a new instance of Collection.
57 58 59 60 |
# File 'lib/object_identifier/formatters/string_formatter.rb', line 57 def initialize(objects, parameters) @objects = objects @parameters = parameters end |
Class Method Details
.call(*args) ⇒ String
Returns the self-identifying String for the passed in object.
50 51 52 |
# File 'lib/object_identifier/formatters/string_formatter.rb', line 50 def self.call(*args) new(*args).call end |
Instance Method Details
#call ⇒ Object
62 63 64 65 66 67 |
# File 'lib/object_identifier/formatters/string_formatter.rb', line 62 def call output_strings = @objects.first(limit).map { |obj| format_single_object(obj) } output_strings << "... (#{truncated_objects_count} more)" if truncated? output_strings.join(", ") end |