Class: NovaposhtaApi::Collection
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- NovaposhtaApi::Collection
- Defined in:
- lib/novaposhta_api/collection.rb
Instance Method Summary collapse
-
#initialize(collection, klass) ⇒ Collection
constructor
A new instance of Collection.
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 |