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