Class: GraphQL::Stitching::PlannerStep

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/stitching/planner_step.rb

Constant Summary collapse

GRAPHQL_PRINTER =
GraphQL::Language::Printer.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location:, parent_type:, index:, after: nil, operation_type: "query", selections: [], variables: {}, path: [], if_type: nil, boundary: nil) ⇒ PlannerStep

Returns a new instance of PlannerStep.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/graphql/stitching/planner_step.rb', line 11

def initialize(
  location:,
  parent_type:,
  index:,
  after: nil,
  operation_type: "query",
  selections: [],
  variables: {},
  path: [],
  if_type: nil,
  boundary: nil
)
  @location = location
  @parent_type = parent_type
  @index = index
  @after = after
  @operation_type = operation_type
  @selections = selections
  @variables = variables
  @path = path
  @if_type = if_type
  @boundary = boundary
end

Instance Attribute Details

#afterObject

Returns the value of attribute after.



9
10
11
# File 'lib/graphql/stitching/planner_step.rb', line 9

def after
  @after
end

#boundaryObject

Returns the value of attribute boundary.



9
10
11
# File 'lib/graphql/stitching/planner_step.rb', line 9

def boundary
  @boundary
end

#if_typeObject (readonly)

Returns the value of attribute if_type.



8
9
10
# File 'lib/graphql/stitching/planner_step.rb', line 8

def if_type
  @if_type
end

#indexObject (readonly)

Returns the value of attribute index.



8
9
10
# File 'lib/graphql/stitching/planner_step.rb', line 8

def index
  @index
end

#locationObject (readonly)

Returns the value of attribute location.



8
9
10
# File 'lib/graphql/stitching/planner_step.rb', line 8

def location
  @location
end

#operation_typeObject (readonly)

Returns the value of attribute operation_type.



8
9
10
# File 'lib/graphql/stitching/planner_step.rb', line 8

def operation_type
  @operation_type
end

#parent_typeObject (readonly)

Returns the value of attribute parent_type.



8
9
10
# File 'lib/graphql/stitching/planner_step.rb', line 8

def parent_type
  @parent_type
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/graphql/stitching/planner_step.rb', line 8

def path
  @path
end

#selectionsObject

Returns the value of attribute selections.



9
10
11
# File 'lib/graphql/stitching/planner_step.rb', line 9

def selections
  @selections
end

#variablesObject

Returns the value of attribute variables.



9
10
11
# File 'lib/graphql/stitching/planner_step.rb', line 9

def variables
  @variables
end

Instance Method Details

#to_plan_opObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/graphql/stitching/planner_step.rb', line 35

def to_plan_op
  GraphQL::Stitching::Plan::Op.new(
    step: @index,
    after: @after,
    location: @location,
    operation_type: @operation_type,
    selections: rendered_selections,
    variables: rendered_variables,
    path: @path,
    if_type: @if_type,
    boundary: @boundary,
  )
end