Class: GraphQL::Language::Nodes::Field

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

Overview

A single selection in a GraphQL query.

Constant Summary

Constants inherited from AbstractNode

AbstractNode::NO_CHILDREN

Instance Attribute Summary collapse

Attributes inherited from AbstractNode

#filename

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractNode

#==, #children, #children_method_name, children_of_type, #col, #definition_line, #delete_child, inherited, #initialize_copy, #line, #merge, #position, #replace_child, #scalars, #to_query_string

Constructor Details

#initialize(name: nil, arguments: NONE, directives: NONE, selections: NONE, field_alias: nil, line: nil, col: nil, pos: nil, filename: nil, source_string: nil) ⇒ Field

Returns a new instance of Field.



387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/graphql/language/nodes.rb', line 387

def initialize(name: nil, arguments: NONE, directives: NONE, selections: NONE, field_alias: nil, line: nil, col: nil, pos: nil, filename: nil, source_string: nil)
  @name = name
  @arguments = arguments || NONE
  @directives = directives || NONE
  @selections = selections || NONE
  # oops, alias is a keyword:
  @alias = field_alias
  @line = line
  @col = col
  @pos = pos
  @filename = filename
  @source_string = source_string
end

Instance Attribute Details

#selectionsArray<Nodes::Field>

Returns Selections on this object (or empty array if this is a scalar field).

Returns:

  • (Array<Nodes::Field>)

    Selections on this object (or empty array if this is a scalar field)



387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/graphql/language/nodes.rb', line 387

def initialize(name: nil, arguments: NONE, directives: NONE, selections: NONE, field_alias: nil, line: nil, col: nil, pos: nil, filename: nil, source_string: nil)
  @name = name
  @arguments = arguments || NONE
  @directives = directives || NONE
  @selections = selections || NONE
  # oops, alias is a keyword:
  @alias = field_alias
  @line = line
  @col = col
  @pos = pos
  @filename = filename
  @source_string = source_string
end

Class Method Details

.from_a(filename, line, col, field_alias, name, arguments, directives, selections) ⇒ Object

rubocop:disable Metrics/ParameterLists



401
402
403
# File 'lib/graphql/language/nodes.rb', line 401

def self.from_a(filename, line, col, field_alias, name, arguments, directives, selections) # rubocop:disable Metrics/ParameterLists
  self.new(filename: filename, line: line, col: col, field_alias: field_alias, name: name, arguments: arguments, directives: directives, selections: selections)
end