Class: GraphQL::Compatibility::LazyExecutionSpecification::LazySchema::LazyPush
- Inherits:
-
Object
- Object
- GraphQL::Compatibility::LazyExecutionSpecification::LazySchema::LazyPush
- Defined in:
- lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(ctx, value) ⇒ LazyPush
constructor
A new instance of LazyPush.
- #push ⇒ Object
Constructor Details
#initialize(ctx, value) ⇒ LazyPush
Returns a new instance of LazyPush.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb', line 8 def initialize(ctx, value) if value == 13 @value = nil elsif value == 14 @value = GraphQL::ExecutionError.new("oops!") elsif value == 15 @skipped = true @value = ctx.skip else @value = value end @context = ctx pushes = @context[:lazy_pushes] ||= [] if !@skipped pushes << @value end end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb', line 7 def value @value end |
Instance Method Details
#push ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb', line 26 def push if @skipped @value else if @context[:lazy_pushes].include?(@value) @context[:lazy_instrumentation] && @context[:lazy_instrumentation] << "PUSH" @context[:pushes] << @context[:lazy_pushes] @context[:lazy_pushes] = [] end # Something that _behaves_ like this object, but isn't registered lazy OpenStruct.new(value: @value) end end |