Class: GraphQL::Language::Nodes::EnumValueDefinition

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

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



2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
# File 'lib/graphql/language/nodes.rb', line 2123

def initialize(name: 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
  @description = description && -description
  @comment = comment
  @directives = directives.freeze
  @definition_pos = definition_pos
end

Instance Attribute Details

#comment ⇒ Object (readonly)

: String?



2105
2106
2107
# File 'lib/graphql/language/nodes.rb', line 2105

def comment
  @comment
end

#description ⇒ Object (readonly)

: String?



2103
2104
2105
# File 'lib/graphql/language/nodes.rb', line 2103

def description
  @description
end

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

: Array



2114
2115
2116
# File 'lib/graphql/language/nodes.rb', line 2114

def directives
  @directives
end

#name ⇒ Object (readonly)

: String



2107
2108
2109
# File 'lib/graphql/language/nodes.rb', line 2107

def name
  @name
end

Class Method Details

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



2136
2137
2138
# File 'lib/graphql/language/nodes.rb', line 2136

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

Instance Method Details

#marshal_dump ⇒ Object



2140
2141
2142
2143
2144
2145
2146
2147
2148
# File 'lib/graphql/language/nodes.rb', line 2140

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

#marshal_load(values) ⇒ Object



2150
2151
2152
# File 'lib/graphql/language/nodes.rb', line 2150

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

#merge_directive(**node_opts) ⇒ Object



2116
2117
2118
# File 'lib/graphql/language/nodes.rb', line 2116

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

#scalars ⇒ Object



2109
2110
2111
# File 'lib/graphql/language/nodes.rb', line 2109

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

#visit_method ⇒ Object



2098
2099
2100
# File 'lib/graphql/language/nodes.rb', line 2098

def visit_method
  :on_enum_value_definition
end