class SyntaxTree::Imaginary

Imaginary represents an imaginary number literal.

1i

Attributes

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

value[R]
String

the value of the imaginary number literal

Public Class Methods

new(value:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 6687
def initialize(value:, location:)
  @value = value
  @location = location
  @comments = []
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 6722
def ===(other)
  other.is_a?(Imaginary) && value === other.value
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 6693
def accept(visitor)
  visitor.visit_imaginary(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 6697
def child_nodes
  []
end
Also aliased as: deconstruct
copy(value: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 6701
def copy(value: nil, location: nil)
  node =
    Imaginary.new(
      value: value || self.value,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 6714
def deconstruct_keys(_keys)
  { value: value, location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 6718
def format(q)
  q.text(value)
end