Class: GraphQL::Language::Nodes::Field
- Inherits:
-
AbstractNode
- Object
- AbstractNode
- GraphQL::Language::Nodes::Field
- Defined in:
- lib/graphql/language/nodes.rb
Overview
A single selection in a GraphQL query.
Instance Attribute Summary collapse
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#name ⇒ Object
Returns the value of attribute name.
-
#selections ⇒ Array<Nodes::Field>
Selections on this object (or empty array if this is a scalar field).
Attributes inherited from AbstractNode
Instance Method Summary collapse
- #children ⇒ Object
- #initialize_node(name: nil, arguments: [], directives: [], selections: [], **kwargs) ⇒ 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
#alias ⇒ Object
Returns the value of attribute alias.
190 191 192 |
# File 'lib/graphql/language/nodes.rb', line 190 def alias @alias end |
#arguments ⇒ Object
Returns the value of attribute arguments.
190 191 192 |
# File 'lib/graphql/language/nodes.rb', line 190 def arguments @arguments end |
#directives ⇒ Object
Returns the value of attribute directives.
190 191 192 |
# File 'lib/graphql/language/nodes.rb', line 190 def directives @directives end |
#name ⇒ Object
Returns the value of attribute name.
190 191 192 |
# File 'lib/graphql/language/nodes.rb', line 190 def name @name end |
#selections ⇒ Array<Nodes::Field>
Returns Selections on this object (or empty array if this is a scalar field).
195 196 197 |
# File 'lib/graphql/language/nodes.rb', line 195 def selections @selections end |
Instance Method Details
#children ⇒ Object
208 209 210 |
# File 'lib/graphql/language/nodes.rb', line 208 def children arguments + directives + selections end |
#initialize_node(name: nil, arguments: [], directives: [], selections: [], **kwargs) ⇒ Object
195 196 197 198 199 200 201 202 |
# File 'lib/graphql/language/nodes.rb', line 195 def initialize_node(name: nil, arguments: [], directives: [], selections: [], **kwargs) @name = name # oops, alias is a keyword: @alias = kwargs.fetch(:alias, nil) @arguments = arguments @directives = directives @selections = selections end |
#scalars ⇒ Object
204 205 206 |
# File 'lib/graphql/language/nodes.rb', line 204 def scalars [name, self.alias] end |