Class: GraphQL::Stitching::TypeResolver::Argument Private
- Inherits:
-
Object
- Object
- GraphQL::Stitching::TypeResolver::Argument
- Defined in:
- lib/graphql/stitching/type_resolver/arguments.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defines a single resolver argument structure
Instance Attribute Summary collapse
- #name ⇒ Object readonly private
- #type_name ⇒ Object readonly private
- #value ⇒ Object readonly private
Instance Method Summary collapse
- #==(other) ⇒ Object private
- #build(origin_obj) ⇒ Object private
-
#initialize(name:, value:, list: false, type_name: nil) ⇒ Argument
constructor
private
A new instance of Argument.
- #key? ⇒ Boolean private
- #list? ⇒ Boolean private
- #print ⇒ Object private
- #to_definition ⇒ Object (also: #to_s) private
- #to_type_definition ⇒ Object private
- #to_type_signature ⇒ Object private
- #verify_key(key) ⇒ Object private
Constructor Details
#initialize(name:, value:, list: false, type_name: nil) ⇒ Argument
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Argument.
12 13 14 15 16 17 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 12 def initialize(name:, value:, list: false, type_name: nil) @name = name @value = value @list = list @type_name = type_name end |
Instance Attribute Details
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 8 def name @name end |
#type_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 10 def type_name @type_name end |
#value ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 9 def value @value end |
Instance Method Details
#==(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 42 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 36 def ==(other) self.class == other.class && @name == other.name && @value == other.value && @type_name == other.type_name && @list == other.list? end |
#build(origin_obj) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 44 def build(origin_obj) value.build(origin_obj) end |
#key? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 23 def key? value.key? end |
#list? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 19 def list? @list end |
#print ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 48 def print "#{name}: #{value.print}" end |
#to_definition ⇒ Object Also known as: to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 52 def to_definition print.gsub(%|"|, "'") end |
#to_type_definition ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 58 def to_type_definition "#{name}: #{to_type_signature}" end |
#to_type_signature ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 63 64 65 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 62 def to_type_signature # need to derive nullability... list? ? "[#{@type_name}!]!" : "#{@type_name}!" end |
#verify_key(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 33 34 |
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 27 def verify_key(key) if key? value.verify_key(self, key) true else false end end |