Class: Graphlyte::Syntax::Fragment
- Includes:
- HasFragmentName
- Defined in:
- lib/graphlyte/syntax.rb
Overview
A definition of a re-usable chunk of an operation See: spec.graphql.org/October2021/#sec-Language.Fragments
Instance Attribute Summary collapse
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#selection ⇒ Object
Returns the value of attribute selection.
-
#type_name ⇒ Object
Returns the value of attribute type_name.
Instance Method Summary collapse
- #executable? ⇒ Boolean
-
#initialize(**kwargs) ⇒ Fragment
constructor
A new instance of Fragment.
- #inline ⇒ Object
- #refers_to(fragment) ⇒ Object
- #required_fragments ⇒ Object
Methods included from HasFragmentName
Methods inherited from Data
#==, attr_accessor, attr_reader, attributes, #dup, #eql?, #hash, #inspect
Constructor Details
#initialize(**kwargs) ⇒ Fragment
Returns a new instance of Fragment.
114 115 116 117 |
# File 'lib/graphlyte/syntax.rb', line 114 def initialize(**kwargs) super @refers_to = [] end |
Instance Attribute Details
#directives ⇒ Object
Returns the value of attribute directives.
112 113 114 |
# File 'lib/graphlyte/syntax.rb', line 112 def directives @directives end |
#selection ⇒ Object
Returns the value of attribute selection.
112 113 114 |
# File 'lib/graphlyte/syntax.rb', line 112 def selection @selection end |
#type_name ⇒ Object
Returns the value of attribute type_name.
112 113 114 |
# File 'lib/graphlyte/syntax.rb', line 112 def type_name @type_name end |
Instance Method Details
#executable? ⇒ Boolean
131 132 133 |
# File 'lib/graphlyte/syntax.rb', line 131 def executable? true end |
#inline ⇒ Object
119 120 121 |
# File 'lib/graphlyte/syntax.rb', line 119 def inline InlineFragment.new(type_name, directives, selection) end |
#refers_to(fragment) ⇒ Object
123 124 125 |
# File 'lib/graphlyte/syntax.rb', line 123 def refers_to(fragment) @refers_to << fragment end |
#required_fragments ⇒ Object
127 128 129 |
# File 'lib/graphlyte/syntax.rb', line 127 def required_fragments [self] + @refers_to end |