Class: GraphQL::Stitching::TypeResolver::KeyField
- Inherits:
-
Object
- Object
- GraphQL::Stitching::TypeResolver::KeyField
- Defined in:
- lib/graphql/stitching/type_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.
97 98 99 100 101 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 97 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
90 91 92 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 90 def inner @inner end |
#list ⇒ Object Also known as: list?
Returns the value of attribute list.
94 95 96 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 94 def list @list end |
#name ⇒ Object (readonly)
name of the key, may be a field alias
87 88 89 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 87 def name @name end |
#type_name ⇒ Object
optional information about location and typing, used during composition
93 94 95 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 93 def type_name @type_name end |
Instance Method Details
#export_node ⇒ Object
107 108 109 110 111 112 113 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 107 def export_node FieldNode.build( field_alias: @root ? "#{EXPORT_PREFIX}#{@name}" : nil, field_name: @name, selections: @inner.export_nodes, ) end |
#to_definition ⇒ Object
103 104 105 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 103 def to_definition @inner.empty? ? @name : "#{@name} { #{@inner.to_definition} }" end |