Class: GraphQL::Language::Nodes::WrapperType

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

Overview

Base class for non-null type names and list type names

Direct Known Subclasses

ListType, NonNullType

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(of_type: nil, line: nil, col: nil, pos: nil, filename: nil, source: nil) ⇒ WrapperType

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



245
246
247
248
249
250
251
252
# File 'lib/graphql/language/nodes.rb', line 245

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

Instance Attribute Details

#of_type ⇒ Object (readonly)

: TypeName | ListType | NonNullType



238
239
240
# File 'lib/graphql/language/nodes.rb', line 238

def of_type
  @of_type
end

Class Method Details

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



254
255
256
# File 'lib/graphql/language/nodes.rb', line 254

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

Instance Method Details

#marshal_dump ⇒ Object



258
259
260
261
262
263
264
# File 'lib/graphql/language/nodes.rb', line 258

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

#marshal_load(values) ⇒ Object



266
267
268
# File 'lib/graphql/language/nodes.rb', line 266

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

#scalars ⇒ Object



240
241
242
# File 'lib/graphql/language/nodes.rb', line 240

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

#visit_method ⇒ Object



233
234
235
# File 'lib/graphql/language/nodes.rb', line 233

def visit_method
  :on_wrapper_type
end