Class: Graphlyte::Syntax::Field
Overview
A discrete piece of information in the Graph See: spec.graphql.org/October2021/#sec-Language.Fields
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#as ⇒ Object
Returns the value of attribute as.
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#name ⇒ Object
Returns the value of attribute name.
-
#selection ⇒ Object
Returns the value of attribute selection.
-
#type ⇒ Object
type is special: it is not part of the serialized Query, but inferred from the schema.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Field
constructor
A new instance of Field.
- #simple? ⇒ Boolean
Methods inherited from Data
#==, attr_accessor, attr_reader, attributes, #dup, #eql?, #hash, #inspect
Constructor Details
#initialize(**kwargs) ⇒ Field
Returns a new instance of Field.
77 78 79 80 81 82 |
# File 'lib/graphlyte/syntax.rb', line 77 def initialize(**kwargs) super @arguments ||= [] @directives ||= [] @selection ||= [] end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
72 73 74 |
# File 'lib/graphlyte/syntax.rb', line 72 def arguments @arguments end |
#as ⇒ Object
Returns the value of attribute as.
72 73 74 |
# File 'lib/graphlyte/syntax.rb', line 72 def as @as end |
#directives ⇒ Object
Returns the value of attribute directives.
72 73 74 |
# File 'lib/graphlyte/syntax.rb', line 72 def directives @directives end |
#name ⇒ Object
Returns the value of attribute name.
72 73 74 |
# File 'lib/graphlyte/syntax.rb', line 72 def name @name end |
#selection ⇒ Object
Returns the value of attribute selection.
72 73 74 |
# File 'lib/graphlyte/syntax.rb', line 72 def selection @selection end |
#type ⇒ Object
type is special: it is not part of the serialized Query, but inferred from the schema. See: editors/annotate_types.rb
75 76 77 |
# File 'lib/graphlyte/syntax.rb', line 75 def type @type end |
Instance Method Details
#simple? ⇒ Boolean
84 85 86 |
# File 'lib/graphlyte/syntax.rb', line 84 def simple? as.nil? && arguments.empty? && directives.empty? && selection.empty? end |