Class: GraphQL::Language::Nodes::UnionTypeDefinition

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

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



1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
# File 'lib/graphql/language/nodes.rb', line 1999

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

Instance Attribute Details

#comment ⇒ Object (readonly)

: String?



1979
1980
1981
# File 'lib/graphql/language/nodes.rb', line 1979

def comment
  @comment
end

#description ⇒ Object (readonly)

: String?



1977
1978
1979
# File 'lib/graphql/language/nodes.rb', line 1977

def description
  @description
end

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

: Array



1990
1991
1992
# File 'lib/graphql/language/nodes.rb', line 1990

def directives
  @directives
end

#name ⇒ Object (readonly)

: String



1983
1984
1985
# File 'lib/graphql/language/nodes.rb', line 1983

def name
  @name
end

#types ⇒ Object (readonly)

: Array



1981
1982
1983
# File 'lib/graphql/language/nodes.rb', line 1981

def types
  @types
end

Class Method Details

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

rubocop:disable Metrics/ParameterLists



2013
2014
2015
# File 'lib/graphql/language/nodes.rb', line 2013

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

Instance Method Details

#marshal_dump ⇒ Object



2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
# File 'lib/graphql/language/nodes.rb', line 2017

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

#marshal_load(values) ⇒ Object



2028
2029
2030
# File 'lib/graphql/language/nodes.rb', line 2028

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

#merge_directive(**node_opts) ⇒ Object



1992
1993
1994
# File 'lib/graphql/language/nodes.rb', line 1992

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

#scalars ⇒ Object



1985
1986
1987
# File 'lib/graphql/language/nodes.rb', line 1985

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

#visit_method ⇒ Object



1972
1973
1974
# File 'lib/graphql/language/nodes.rb', line 1972

def visit_method
  :on_union_type_definition
end