Class: GraphQL::Language::Nodes::ScalarTypeExtension

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

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_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, directives: NO_CHILDREN, line: nil, col: nil, pos: nil, filename: nil, source: nil) ⇒ ScalarTypeExtension

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



1421
1422
1423
1424
1425
1426
1427
1428
1429
# File 'lib/graphql/language/nodes.rb', line 1421

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

Instance Attribute Details

#directives ⇒ Object (readonly) Also known as: children

: Array



1412
1413
1414
# File 'lib/graphql/language/nodes.rb', line 1412

def directives
  @directives
end

#name ⇒ Object (readonly)

: String



1405
1406
1407
# File 'lib/graphql/language/nodes.rb', line 1405

def name
  @name
end

Class Method Details

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



1431
1432
1433
# File 'lib/graphql/language/nodes.rb', line 1431

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

Instance Method Details

#marshal_dump ⇒ Object



1435
1436
1437
1438
1439
1440
1441
1442
# File 'lib/graphql/language/nodes.rb', line 1435

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

#marshal_load(values) ⇒ Object



1444
1445
1446
# File 'lib/graphql/language/nodes.rb', line 1444

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

#merge_directive(**node_opts) ⇒ Object



1414
1415
1416
# File 'lib/graphql/language/nodes.rb', line 1414

def merge_directive(**node_opts)
  merge(directives: directives + [GraphQL::Language::Nodes::Directive.new(**node_opts)])
end

#scalars ⇒ Object



1407
1408
1409
# File 'lib/graphql/language/nodes.rb', line 1407

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

#visit_method ⇒ Object



1400
1401
1402
# File 'lib/graphql/language/nodes.rb', line 1400

def visit_method
  :on_scalar_type_extension
end