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

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: nil) ⇒ Field

Returns a new instance of Field.



397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/graphql/language/nodes.rb', line 397

def initialize(name: nil, arguments: NONE, directives: NONE, selections: NONE, field_alias: nil, line: nil, col: nil, pos: nil, filename: nil, source: 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 = source
end

Class Method Details

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

rubocop:disable Metrics/ParameterLists



411
412
413
# File 'lib/graphql/language/nodes.rb', line 411

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

Instance Method Details

#marshal_dumpObject



415
416
417
# File 'lib/graphql/language/nodes.rb', line 415

def marshal_dump
  [line, col, @filename, @name, @arguments, @directives, @selections, @alias]
end

#marshal_load(values) ⇒ Object



419
420
421
# File 'lib/graphql/language/nodes.rb', line 419

def marshal_load(values)
  @line, @col, @filename, @name, @arguments, @directives, @selections, @alias = values
end