Sha256: ad8b4bea83ab2bbefeea0b5e6c96c77a007b5e86bc2c0a1dbb3d1d26fd89de10

Contents?: true

Size: 319 Bytes

Versions: 4

Compression:

Stored size: 319 Bytes

Contents

# frozen_string_literal: true

module NovaposhtaApi
  class Collection < SimpleDelegator
    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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
novaposhta_api-0.2.1 lib/novaposhta_api/collection.rb
novaposhta_api-0.2.0 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.9 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.8 lib/novaposhta_api/collection.rb