Class: GraphQL::Language::Nodes::OperationDefinition
- Inherits:
-
AbstractNode
- Object
- AbstractNode
- GraphQL::Language::Nodes::OperationDefinition
- Defined in:
- lib/graphql/language/nodes.rb
Overview
A query, mutation or subscription.
May be anonymous or named.
May be explicitly typed (eg mutation { ... }
) or implicitly a query (eg { ... }
).
Instance Attribute Summary collapse
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#name ⇒ String?
The name for this operation, or
nil
if unnamed. -
#operation_type ⇒ String?
The root type for this operation, or
nil
for implicit"query"
. -
#selections ⇒ Array<Field>
Root-level fields on this operation.
-
#variables ⇒ Array<VariableDefinition>
Variable definitions for this operation.
Attributes inherited from AbstractNode
Instance Method Summary collapse
-
#children ⇒ Object
-
#initialize_node(operation_type: nil, name: nil, variables: [], directives: [], selections: []) ⇒ Object
-
#scalars ⇒ Object
Methods inherited from AbstractNode
#eql?, #initialize, #position, #to_query_string
Constructor Details
This class inherits a constructor from GraphQL::Language::Nodes::AbstractNode
Instance Attribute Details
#directives ⇒ Object
Returns the value of attribute directives
326 327 328 |
# File 'lib/graphql/language/nodes.rb', line 326 def directives @directives end |
#name ⇒ String?
Returns The name for this operation, or nil
if unnamed
340 341 342 |
# File 'lib/graphql/language/nodes.rb', line 340 def name @name end |
#operation_type ⇒ String?
Returns The root type for this operation, or nil
for implicit "query"
334 335 336 |
# File 'lib/graphql/language/nodes.rb', line 334 def operation_type @operation_type end |
#selections ⇒ Array<Field>
Returns Root-level fields on this operation
331 332 333 |
# File 'lib/graphql/language/nodes.rb', line 331 def selections @selections end |
#variables ⇒ Array<VariableDefinition>
Returns Variable definitions for this operation
328 329 330 |
# File 'lib/graphql/language/nodes.rb', line 328 def variables @variables end |
Instance Method Details
#children ⇒ Object
348 349 350 |
# File 'lib/graphql/language/nodes.rb', line 348 def children variables + directives + selections end |
#initialize_node(operation_type: nil, name: nil, variables: [], directives: [], selections: []) ⇒ Object
340 341 342 343 344 345 346 |
# File 'lib/graphql/language/nodes.rb', line 340 def initialize_node(operation_type: nil, name: nil, variables: [], directives: [], selections: []) @operation_type = operation_type @name = name @variables = variables @directives = directives @selections = selections end |
#scalars ⇒ Object
352 353 354 |
# File 'lib/graphql/language/nodes.rb', line 352 def scalars [operation_type, name] end |