Class: GraphQL::Language::Nodes::InputValueDefinition

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, type: nil, default_value: nil, description: nil, comment: nil, directives: NO_CHILDREN, line: nil, col: nil, pos: nil, filename: nil, source: nil, definition_pos: nil) ⇒ InputValueDefinition

: (?name: untyped, ?type: untyped, ?default_value: untyped, ?description: untyped, ?comment: untyped, ?directives: Array, ?line: Integer?, ?col: Integer?, ?pos: Integer?, ?filename: String?, ?source: untyped, ?definition_pos: Integer?) -> void



1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
# File 'lib/graphql/language/nodes.rb', line 1484

def initialize(name: nil, type: nil, default_value: nil, description: nil, comment: nil, directives: NO_CHILDREN, line: nil, col: nil, pos: nil, filename: nil, source: nil, definition_pos: nil)
  @line = line
  @col = col
  @pos = pos
  @filename = filename
  @source = source
  @name = name
  @type = type
  @default_value = default_value
  @description = description && -description
  @comment = comment
  @directives = directives.freeze
  @definition_pos = definition_pos
end

Instance Attribute Details

#comment ⇒ Object (readonly)

: String?



1462
1463
1464
# File 'lib/graphql/language/nodes.rb', line 1462

def comment
  @comment
end

#default_value ⇒ Object (readonly)

: untyped



1468
1469
1470
# File 'lib/graphql/language/nodes.rb', line 1468

def default_value
  @default_value
end

#description ⇒ Object (readonly)

: String?



1460
1461
1462
# File 'lib/graphql/language/nodes.rb', line 1460

def description
  @description
end

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

: Array



1475
1476
1477
# File 'lib/graphql/language/nodes.rb', line 1475

def directives
  @directives
end

#name ⇒ Object (readonly)

: String



1464
1465
1466
# File 'lib/graphql/language/nodes.rb', line 1464

def name
  @name
end

#type ⇒ Object (readonly)

: TypeName | ListType | NonNullType



1466
1467
1468
# File 'lib/graphql/language/nodes.rb', line 1466

def type
  @type
end

Class Method Details

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

rubocop:disable Metrics/ParameterLists



1499
1500
1501
# File 'lib/graphql/language/nodes.rb', line 1499

def self.from_a(filename, line, col, name, type, default_value, description, directives, comment: nil) # rubocop:disable Metrics/ParameterLists
  self.new(filename: filename, line: line, col: col, name: name, type: type, default_value: default_value, description: description, comment: comment, directives: directives)
end

Instance Method Details

#marshal_dump ⇒ Object



1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
# File 'lib/graphql/language/nodes.rb', line 1503

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

#marshal_load(values) ⇒ Object



1515
1516
1517
# File 'lib/graphql/language/nodes.rb', line 1515

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

#merge_directive(**node_opts) ⇒ Object



1477
1478
1479
# File 'lib/graphql/language/nodes.rb', line 1477

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

#scalars ⇒ Object



1470
1471
1472
# File 'lib/graphql/language/nodes.rb', line 1470

def scalars
  @scalars ||= [@name, @type, @default_value].freeze
end

#visit_method ⇒ Object



1455
1456
1457
# File 'lib/graphql/language/nodes.rb', line 1455

def visit_method
  :on_input_value_definition
end