Class: Rails::GraphQL::Request::Strategy::SequencedStrategy

Inherits:
Rails::GraphQL::Request::Strategy show all
Defined in:
lib/rails/graphql/request/strategy/sequenced_strategy.rb

Overview

GraphQl Sequenced Strategy

This is the default resolution strategy, where each operation is performed in sequece, and they don’t relate to each other in any way.

Constant Summary

Constants inherited from Rails::GraphQL::Request::Strategy

PREPARE_XARGS

Instance Attribute Summary

Attributes inherited from Rails::GraphQL::Request::Strategy

#context, #listeners, #request, #stage

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rails::GraphQL::Request::Strategy

#add_listeners_from, #cache_dump, #cache_load, #clear, #compile, #find_directive!, #find_type!, #initialize, #instance_for, #listeners?, #listening_to?, #perform, #prepare, #prepared_data_for, #resolve, #resolve_data_for, #safe_store_data, #stacked, #store_data, #trigger_event

Constructor Details

This class inherits a constructor from Rails::GraphQL::Request::Strategy

Class Method Details

.can_resolve?(_) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/rails/graphql/request/strategy/sequenced_strategy.rb', line 11

def self.can_resolve?(_)
  true
end

Instance Method Details

#resolve!Object

Executes the strategy in the normal mode



16
17
18
19
20
21
22
23
24
# File 'lib/rails/graphql/request/strategy/sequenced_strategy.rb', line 16

def resolve!
  response.with_stack('data') do
    for_each_operation do |op|
      collect_listeners          { op.organize! }
      collect_data(op.mutation?) { op.prepare! }
      collect_response           { op.resolve! }
    end
  end
end