Class: GraphQL::Language::Nodes::Argument

Inherits:
AbstractNode show all
Defined in:
lib/graphql/language/nodes.rb

Overview

A key-value pair for a field's inputs

Instance Attribute Summary collapse

Attributes inherited from AbstractNode

#col, #filename, #line

Instance Method Summary collapse

Methods inherited from AbstractNode

child_attributes, #eql?, inherited, #initialize, #position, scalar_attributes, #scalars, #to_query_string

Constructor Details

This class inherits a constructor from GraphQL::Language::Nodes::AbstractNode

Instance Attribute Details

#nameString

Returns the key for this argument

Returns:

  • (String)

    the key for this argument


119
120
121
# File 'lib/graphql/language/nodes.rb', line 119

def name
  @name
end

#valueString, ...

Returns The value passed for this key

Returns:

  • (String, Float, Integer, Boolean, Array, InputObject)

    The value passed for this key


125
126
127
# File 'lib/graphql/language/nodes.rb', line 125

def value
  @value
end

Instance Method Details

#childrenObject


130
131
132
# File 'lib/graphql/language/nodes.rb', line 130

def children
  [value].flatten.select { |v| v.is_a?(AbstractNode) }
end

#initialize_node(name: nil, value: nil) ⇒ Object


125
126
127
128
# File 'lib/graphql/language/nodes.rb', line 125

def initialize_node(name: nil, value: nil)
  @name = name
  @value = value
end