Class: GraphQL::Stitching::Plan
- Inherits:
-
Object
- Object
- GraphQL::Stitching::Plan
- Defined in:
- lib/graphql/stitching/plan.rb
Overview
Immutable structures representing a query plan. May serialize to/from JSON.
Defined Under Namespace
Classes: Op
Instance Attribute Summary collapse
-
#ops ⇒ Object
readonly
Returns the value of attribute ops.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(ops: []) ⇒ Plan
constructor
A new instance of Plan.
Constructor Details
#initialize(ops: []) ⇒ Plan
Returns a new instance of Plan.
90 91 92 |
# File 'lib/graphql/stitching/plan.rb', line 90 def initialize(ops: []) @ops = ops end |
Instance Attribute Details
#ops ⇒ Object (readonly)
Returns the value of attribute ops.
88 89 90 |
# File 'lib/graphql/stitching/plan.rb', line 88 def ops @ops end |
Class Method Details
.from_json(json) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/graphql/stitching/plan.rb', line 69 def from_json(json) ops = json["ops"] ops = ops.map do |op| Op.new( step: op["step"], after: op["after"], location: op["location"], operation_type: op["operation_type"], selections: op["selections"], variables: op["variables"], path: op["path"], if_type: op["if_type"], resolver: op["resolver"], ) end new(ops: ops) end |
Instance Method Details
#as_json ⇒ Object
94 95 96 |
# File 'lib/graphql/stitching/plan.rb', line 94 def as_json { ops: @ops.map(&:as_json) } end |