Class: GraphQL::Stitching::TypeResolver::KeyFieldSet
- Inherits:
-
Array
- Object
- Array
- GraphQL::Stitching::TypeResolver::KeyFieldSet
- Defined in:
- lib/graphql/stitching/type_resolver/keys.rb
Direct Known Subclasses
Instance Method Summary collapse
- #==(other) ⇒ Object
- #export_nodes ⇒ Object
-
#initialize(fields) ⇒ KeyFieldSet
constructor
A new instance of KeyFieldSet.
- #primitive_name ⇒ Object
- #to_definition ⇒ Object (also: #to_s)
Constructor Details
#initialize(fields) ⇒ KeyFieldSet
Returns a new instance of KeyFieldSet.
34 35 36 37 38 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 34 def initialize(fields) super(fields.sort_by(&:name)) @to_definition = nil @export_nodes = nil end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 40 def ==(other) to_definition == other.to_definition end |
#export_nodes ⇒ Object
54 55 56 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 54 def export_nodes @export_nodes ||= map(&:export_node) end |
#primitive_name ⇒ Object
44 45 46 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 44 def primitive_name length == 1 ? first.name : nil end |
#to_definition ⇒ Object Also known as: to_s
48 49 50 |
# File 'lib/graphql/stitching/type_resolver/keys.rb', line 48 def to_definition @to_definition ||= map(&:to_definition).join(" ").freeze end |