Class: GraphQL::Stitching::Resolver::KeyFieldSet

Inherits:
Array
  • Object
show all
Defined in:
lib/graphql/stitching/resolver/keys.rb

Direct Known Subclasses

Key

Instance Method Summary collapse

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_nameObject



45
46
47
# File 'lib/graphql/stitching/resolver/keys.rb', line 45

def default_argument_name
  length == 1 ? first.name : nil
end

#export_nodesObject



55
56
57
# File 'lib/graphql/stitching/resolver/keys.rb', line 55

def export_nodes
  @export_nodes ||= map(&:export_node)
end

#to_definitionObject 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