Class: GraphQL::Language::Nodes::UnionTypeExtension

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

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



2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
# File 'lib/graphql/language/nodes.rb', line 2062

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

Instance Attribute Details

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

: Array



2053
2054
2055
# File 'lib/graphql/language/nodes.rb', line 2053

def directives
  @directives
end

#name ⇒ Object (readonly)

: String



2046
2047
2048
# File 'lib/graphql/language/nodes.rb', line 2046

def name
  @name
end

#types ⇒ Object (readonly)

: Array



2044
2045
2046
# File 'lib/graphql/language/nodes.rb', line 2044

def types
  @types
end

Class Method Details

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



2073
2074
2075
# File 'lib/graphql/language/nodes.rb', line 2073

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

Instance Method Details

#marshal_dump ⇒ Object



2077
2078
2079
2080
2081
2082
2083
2084
2085
# File 'lib/graphql/language/nodes.rb', line 2077

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

#marshal_load(values) ⇒ Object



2087
2088
2089
# File 'lib/graphql/language/nodes.rb', line 2087

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

#merge_directive(**node_opts) ⇒ Object



2055
2056
2057
# File 'lib/graphql/language/nodes.rb', line 2055

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

#scalars ⇒ Object



2048
2049
2050
# File 'lib/graphql/language/nodes.rb', line 2048

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

#visit_method ⇒ Object



2039
2040
2041
# File 'lib/graphql/language/nodes.rb', line 2039

def visit_method
  :on_union_type_extension
end