Class: GraphQL::Relay::ConnectionResolve
- Inherits:
-
Object
- Object
- GraphQL::Relay::ConnectionResolve
- Defined in:
- lib/graphql/relay/connection_resolve.rb
Instance Method Summary collapse
- #call(obj, args, ctx) ⇒ Object
-
#initialize(field, underlying_resolve) ⇒ ConnectionResolve
constructor
A new instance of ConnectionResolve.
Constructor Details
#initialize(field, underlying_resolve) ⇒ ConnectionResolve
Returns a new instance of ConnectionResolve.
5 6 7 8 9 |
# File 'lib/graphql/relay/connection_resolve.rb', line 5 def initialize(field, ) @field = field @underlying_resolve = @max_page_size = field.connection_max_page_size end |
Instance Method Details
#call(obj, args, ctx) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/graphql/relay/connection_resolve.rb', line 11 def call(obj, args, ctx) # in a lazy ressolve hook, obj is the promise, # get the object that the promise was # originally derived from parent = ctx.object nodes = @underlying_resolve.call(obj, args, ctx) if nodes.nil? || ctx.schema.lazy?(nodes) || nodes.is_a?(GraphQL::Execution::Execute::Skip) || ctx.wrapped_connection nodes else ctx.wrapped_connection = true build_connection(nodes, args, parent, ctx) end end |