Class: GraphQL::Execution::Next::LoadArgumentStep
- Inherits:
-
Object
- Object
- GraphQL::Execution::Next::LoadArgumentStep
- Defined in:
- lib/graphql/execution/next/load_argument_step.rb
Instance Method Summary collapse
-
#call ⇒ Object
-
#initialize(field_resolve_step:, arguments:, load_receiver:, argument_value:, argument_definition:, argument_key:) ⇒ LoadArgumentStep
constructor
A new instance of LoadArgumentStep.
-
#value ⇒ Object
Constructor Details
#initialize(field_resolve_step:, arguments:, load_receiver:, argument_value:, argument_definition:, argument_key:) ⇒ LoadArgumentStep
Returns a new instance of LoadArgumentStep.
6 7 8 9 10 11 12 13 14 |
# File 'lib/graphql/execution/next/load_argument_step.rb', line 6 def initialize(field_resolve_step:, arguments:, load_receiver:, argument_value:, argument_definition:, argument_key:) @field_resolve_step = field_resolve_step @load_receiver = load_receiver @arguments = arguments @argument_value = argument_value @argument_definition = argument_definition @argument_key = argument_key @loaded_value = nil end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/graphql/execution/next/load_argument_step.rb', line 21 def call context = @field_resolve_step.selections_step.query.context @loaded_value = @load_receiver.(@argument_definition, @argument_value, context) if (runner = @field_resolve_step.runner).resolves_lazies && runner.lazy?(@loaded_value) runner.dataloader.lazy_at_depth(@field_resolve_step.path.size, self) else assign_value end rescue GraphQL::RuntimeError => err @loaded_value = err assign_value rescue StandardError => stderr @loaded_value = begin context.query.handle_or_reraise(stderr) rescue GraphQL::ExecutionError => ex_err ex_err end assign_value end |
#value ⇒ Object
16 17 18 19 |
# File 'lib/graphql/execution/next/load_argument_step.rb', line 16 def value @loaded_value = @field_resolve_step.sync(@loaded_value) assign_value end |