class SyntaxTree::Super

Super represents using the super keyword with arguments. It can optionally use parentheses.

super(value)

Attributes

arguments[R]
ArgParen | Args

the arguments to the keyword

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

Public Class Methods

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

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 10465
def ===(other)
  other.is_a?(Super) && arguments === other.arguments
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 10427
def accept(visitor)
  visitor.visit_super(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 10431
def child_nodes
  [arguments]
end
Also aliased as: deconstruct
copy(arguments: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 10435
def copy(arguments: nil, location: nil)
  node =
    Super.new(
      arguments: arguments || self.arguments,
      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 10448
def deconstruct_keys(_keys)
  { arguments: arguments, location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 10452
def format(q)
  q.group do
    q.text("super")

    if arguments.is_a?(ArgParen)
      q.format(arguments)
    else
      q.text(" ")
      q.nest("super ".length) { q.format(arguments) }
    end
  end
end