Class: SyntaxTree::ZSuper

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

ZSuper represents the bare super keyword with no arguments.

super

Instance Attribute Summary collapse

Attributes inherited from Node

#location

Instance Method Summary collapse

Methods inherited from Node

#construct_keys, #pretty_print, #to_json

Constructor Details

#initialize(location:) ⇒ ZSuper



12178
12179
12180
12181
# File 'lib/syntax_tree/node.rb', line 12178

def initialize(location:)
  @location = location
  @comments = []
end

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



12176
12177
12178
# File 'lib/syntax_tree/node.rb', line 12176

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



12208
12209
12210
# File 'lib/syntax_tree/node.rb', line 12208

def ===(other)
  other.is_a?(ZSuper)
end

#accept(visitor) ⇒ Object



12183
12184
12185
# File 'lib/syntax_tree/node.rb', line 12183

def accept(visitor)
  visitor.visit_zsuper(self)
end

#child_nodesObject Also known as: deconstruct



12187
12188
12189
# File 'lib/syntax_tree/node.rb', line 12187

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



12191
12192
12193
12194
12195
12196
# File 'lib/syntax_tree/node.rb', line 12191

def copy(location: nil)
  node = ZSuper.new(location: location || self.location)

  node.comments.concat(comments.map(&:copy))
  node
end

#deconstruct_keys(_keys) ⇒ Object



12200
12201
12202
# File 'lib/syntax_tree/node.rb', line 12200

def deconstruct_keys(_keys)
  { location: location, comments: comments }
end

#format(q) ⇒ Object



12204
12205
12206
# File 'lib/syntax_tree/node.rb', line 12204

def format(q)
  q.text("super")
end