Class: GraphQL::Stitching::TypeResolver::Argument Private

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#nameObject (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_nameObject (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

#valueObject (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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


19
20
21
# File 'lib/graphql/stitching/type_resolver/arguments.rb', line 19

def list?
  @list
end

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_definitionObject 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_definitionObject

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_signatureObject

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