Sha256: 8ceab8bff00b0b0fcbd135ed74248d998f9a6d6b7bbf6810530f54b587a4bf51

Contents?: true

Size: 324 Bytes

Versions: 7

Compression:

Stored size: 324 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) }

      __setobj__(@collection)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
novaposhta_api-0.1.7 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.5 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.4 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.3 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.2 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.1 lib/novaposhta_api/collection.rb
novaposhta_api-0.1.0 lib/novaposhta_api/collection.rb