Sha256: 8915f62d15f68c047dc34fad1932d627764665e71ad26bb835b782d6bf48a56c

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  module Client
    class GraphConnection < GraphObject
      include Enumerable

      def each
        return enum_for(:each) unless block_given?
        edges.each { |edge| yield edge.node }
      end

      def next_page_query
        build_minimal_query do |connection|
          connection.add_arguments(**query.arguments, after: edges.last.cursor)
          connection.selection_set = query.selection_set
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql_client-0.4.1 lib/graphql_client/graph_connection.rb
graphql_client-0.3.3 lib/graphql_client/graph_connection.rb