Sha256: 1d4accc853af135e874ec7d8972519c7d86497d5b5efbbb54273740414d997e8

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 Bytes

Contents

module Ecoportal
  module API
    class GraphQL
      module Logic
        class QueryArray < Ecoportal::API::GraphQL::Logic::Query
          include Enumerable

          def each(item_block: nil, **kargs, &block)
            return to_enum(:each, **kargs, item_block: connection_block) unless block
            query(**kargs, &item_block).each do |item|
              yield(item) if block_given?
            end
          end

          def response_class
            return array_class if respond_to?(:array_class)
            @response_class ||= self.class.new_class(
              item_class,
              inherits: Ecoportal::API::Common::Content::CollectionModel
            ) do |klass|
              klass.klass = item_class
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ecoportal-api-graphql-0.3.13 lib/ecoportal/api/graphql/logic/query_array.rb
ecoportal-api-graphql-0.3.12 lib/ecoportal/api/graphql/logic/query_array.rb
ecoportal-api-graphql-0.3.11 lib/ecoportal/api/graphql/logic/query_array.rb
ecoportal-api-graphql-0.3.10 lib/ecoportal/api/graphql/logic/query_array.rb
ecoportal-api-graphql-0.3.9 lib/ecoportal/api/graphql/logic/query_array.rb