Class: GraphQL::Language::Nodes::NameOnlyNode

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

Overview

Base class for nodes whose only value is a name (no child nodes or other scalars)

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, #to_query_string

Constructor Details

#initialize(name: nil, line: nil, col: nil, pos: nil, filename: nil, source: nil) ⇒ NameOnlyNode

: (?name: untyped, ?line: Integer?, ?col: Integer?, ?pos: Integer?, ?filename: String?, ?source: untyped) -> void



287
288
289
290
291
292
293
294
# File 'lib/graphql/language/nodes.rb', line 287

def initialize(name: nil, line: nil, col: nil, pos: nil, filename: nil, source: nil)
  @line = line
  @col = col
  @pos = pos
  @filename = filename
  @source = source
  @name = name
end

Instance Attribute Details

#name ⇒ Object (readonly)

: String



280
281
282
# File 'lib/graphql/language/nodes.rb', line 280

def name
  @name
end

Class Method Details

.from_a(filename, line, col, name, comment: nil) ⇒ Object



296
297
298
# File 'lib/graphql/language/nodes.rb', line 296

def self.from_a(filename, line, col, name, comment: nil)
  self.new(filename: filename, line: line, col: col, name: name)
end

Instance Method Details

#marshal_dump ⇒ Object



300
301
302
303
304
305
306
# File 'lib/graphql/language/nodes.rb', line 300

def marshal_dump
  [
    line, col, # use methods here to force them to be calculated
    @filename,
    @name,
  ]
end

#marshal_load(values) ⇒ Object



308
309
310
# File 'lib/graphql/language/nodes.rb', line 308

def marshal_load(values)
  @line, @col, @filename, @name = values
end

#scalars ⇒ Object



282
283
284
# File 'lib/graphql/language/nodes.rb', line 282

def scalars
  @scalars ||= [@name].freeze
end

#visit_method ⇒ Object



275
276
277
# File 'lib/graphql/language/nodes.rb', line 275

def visit_method
  :on_name_only_node
end