Class: GraphQL::Relay::ConnectionResolve

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/relay/connection_resolve.rb

Instance Method Summary collapse

Constructor Details

#initialize(field, underlying_resolve, max_page_size: nil) ⇒ ConnectionResolve

Returns a new instance of ConnectionResolve


4
5
6
7
8
# File 'lib/graphql/relay/connection_resolve.rb', line 4

def initialize(field, underlying_resolve, max_page_size: nil)
  @field = field
  @underlying_resolve = underlying_resolve
  @max_page_size = max_page_size
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object


10
11
12
13
14
# File 'lib/graphql/relay/connection_resolve.rb', line 10

def call(obj, args, ctx)
  nodes = @underlying_resolve.call(obj, args, ctx)
  connection_class = GraphQL::Relay::BaseConnection.connection_for_nodes(nodes)
  connection_class.new(nodes, args, field: @field, max_page_size: @max_page_size, parent: obj)
end