Class: NovaposhtaApi::Collection

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/novaposhta_api/collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(collection, klass) ⇒ Collection

Returns a new instance of Collection.



5
6
7
8
9
10
11
# File 'lib/novaposhta_api/collection.rb', line 5

def initialize(collection, klass)
  fail StandardError, 'Collection must be a Array' unless collection.is_a? Array

  @collection = collection.map { |item| klass.new(item) }

  super(@collection)
end