Class: GraphQL::Client::GraphConnection

Inherits:
GraphObject show all
Includes:
Enumerable
Defined in:
lib/graphql_client/graph_connection.rb

Instance Attribute Summary

Attributes inherited from GraphObject

#data, #parent, #query

Instance Method Summary collapse

Methods inherited from GraphObject

#build_minimal_query, #initialize

Constructor Details

This class inherits a constructor from GraphQL::Client::GraphObject

Instance Method Details

#eachObject



8
9
10
11
# File 'lib/graphql_client/graph_connection.rb', line 8

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

#next_page_queryObject



13
14
15
16
17
18
# File 'lib/graphql_client/graph_connection.rb', line 13

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