Class: Cygnet::MappedCollection

Inherits:
Array
  • Object
show all
Defined in:
lib/cygnet/collections.rb

Overview

Builds flattened collections of objects for easy return

Direct Known Subclasses

PaginatedCollection

Instance Method Summary collapse

Constructor Details

#initialize(builder, records) ⇒ MappedCollection

rubocop:disable Lint/MissingSuper



6
7
8
9
10
11
# File 'lib/cygnet/collections.rb', line 6

def initialize(builder, records) # rubocop:disable Lint/MissingSuper
  @builder = builder
  @records = records
  self << records.map(&builder.method(:new))
  flatten!
end