Class: GraphQL::Schema::MiddlewareChain Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/graphql/schema/middleware_chain.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Given #steps and arguments, call steps in order, passing (*arguments, next_step).

Steps should call next_step.call to continue the chain, or not call it to stop the chain.

Defined Under Namespace

Classes: MiddlewareWrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(steps: [], final_step: nil) ⇒ MiddlewareChain

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MiddlewareChain



13
14
15
16
# File 'lib/graphql/schema/middleware_chain.rb', line 13

def initialize(steps: [], final_step: nil)
  @steps = steps
  @final_step = final_step
end

Instance Attribute Details

#final_stepArray<#call(*args)> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Steps in this chain, will be called with arguments and next_middleware

Returns:

  • (Array<#call(*args)>)

    Steps in this chain, will be called with arguments and next_middleware



11
12
13
# File 'lib/graphql/schema/middleware_chain.rb', line 11

def final_step
  @final_step
end

#stepsArray<#call(*args)> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Steps in this chain, will be called with arguments and next_middleware

Returns:

  • (Array<#call(*args)>)

    Steps in this chain, will be called with arguments and next_middleware



11
12
13
# File 'lib/graphql/schema/middleware_chain.rb', line 11

def steps
  @steps
end

Instance Method Details

#<<(callable) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/graphql/schema/middleware_chain.rb', line 25

def <<(callable)
  add_middleware(callable)
end

#==(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
# File 'lib/graphql/schema/middleware_chain.rb', line 33

def ==(other)
  steps == other.steps && final_step == other.final_step
end

#concat(callables) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/graphql/schema/middleware_chain.rb', line 41

def concat(callables)
  callables.each { |c| add_middleware(c) }
end

#initialize_copy(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
# File 'lib/graphql/schema/middleware_chain.rb', line 18

def initialize_copy(other)
  super
  @steps = other.steps.dup
end

#invoke(arguments) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'lib/graphql/schema/middleware_chain.rb', line 37

def invoke(arguments)
  invoke_core(0, arguments)
end

#push(callable) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/graphql/schema/middleware_chain.rb', line 29

def push(callable)
  add_middleware(callable)
end