Class: GraphQL::Stitching::Resolver::KeyField
- Inherits:
-
Object
- Object
- GraphQL::Stitching::Resolver::KeyField
- Defined in:
- lib/graphql/stitching/resolver/keys.rb
Instance Attribute Summary collapse
-
#inner ⇒ Object
readonly
inner key selections.
-
#list ⇒ Object
(also: #list?)
Returns the value of attribute list.
-
#name ⇒ Object
readonly
name of the key, may be a field alias.
-
#type_name ⇒ Object
optional information about location and typing, used during composition.
Instance Method Summary collapse
- #export_node ⇒ Object
-
#initialize(name, root: false, inner: EMPTY_FIELD_SET) ⇒ KeyField
constructor
A new instance of KeyField.
- #to_definition ⇒ Object
Constructor Details
#initialize(name, root: false, inner: EMPTY_FIELD_SET) ⇒ KeyField
Returns a new instance of KeyField.
98 99 100 101 102 |
# File 'lib/graphql/stitching/resolver/keys.rb', line 98 def initialize(name, root: false, inner: EMPTY_FIELD_SET) @name = name @inner = inner @root = root end |
Instance Attribute Details
#inner ⇒ Object (readonly)
inner key selections
91 92 93 |
# File 'lib/graphql/stitching/resolver/keys.rb', line 91 def inner @inner end |
#list ⇒ Object Also known as: list?
Returns the value of attribute list.
95 96 97 |
# File 'lib/graphql/stitching/resolver/keys.rb', line 95 def list @list end |
#name ⇒ Object (readonly)
name of the key, may be a field alias
88 89 90 |
# File 'lib/graphql/stitching/resolver/keys.rb', line 88 def name @name end |
#type_name ⇒ Object
optional information about location and typing, used during composition
94 95 96 |
# File 'lib/graphql/stitching/resolver/keys.rb', line 94 def type_name @type_name end |
Instance Method Details
#export_node ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/graphql/stitching/resolver/keys.rb', line 108 def export_node FieldNode.build( field_alias: @root ? "#{EXPORT_PREFIX}#{@name}" : nil, field_name: @name, selections: @inner.export_nodes, ) end |
#to_definition ⇒ Object
104 105 106 |
# File 'lib/graphql/stitching/resolver/keys.rb', line 104 def to_definition @inner.empty? ? @name : "#{@name} { #{@inner.to_definition} }" end |