Class: Graphlyte::Syntax::VariableReference
- Defined in:
- lib/graphlyte/syntax.rb
Overview
A use of a variable in an operation or fragment See: spec.graphql.org/October2021/#Variable
Instance Attribute Summary collapse
-
#inferred_type ⇒ Object
Returns the value of attribute inferred_type.
-
#variable ⇒ Object
Returns the value of attribute variable.
Instance Method Summary collapse
-
#initialize(variable = nil, inferred_type = nil, **kwargs) ⇒ VariableReference
constructor
A new instance of VariableReference.
- #to_definition ⇒ Object
Methods inherited from Data
#==, attr_accessor, attr_reader, attributes, #dup, #eql?, #hash, #inspect
Constructor Details
#initialize(variable = nil, inferred_type = nil, **kwargs) ⇒ VariableReference
Returns a new instance of VariableReference.
148 149 150 151 152 |
# File 'lib/graphlyte/syntax.rb', line 148 def initialize(variable = nil, inferred_type = nil, **kwargs) super(**kwargs) @variable ||= variable @inferred_type ||= inferred_type end |
Instance Attribute Details
#inferred_type ⇒ Object
Returns the value of attribute inferred_type.
146 147 148 |
# File 'lib/graphlyte/syntax.rb', line 146 def inferred_type @inferred_type end |
#variable ⇒ Object
Returns the value of attribute variable.
146 147 148 |
# File 'lib/graphlyte/syntax.rb', line 146 def variable @variable end |
Instance Method Details
#to_definition ⇒ Object
154 155 156 |
# File 'lib/graphlyte/syntax.rb', line 154 def to_definition VariableDefinition.new(variable: variable, type: inferred_type) end |