Class: SyntaxTree::ZSuper
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::ZSuper
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
Returns a new instance of ZSuper.
12208
12209
12210
12211
|
# File 'lib/syntax_tree/node.rb', line 12208
def initialize(location:)
@location = location
@comments = []
end
|
Instance Attribute Details
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
12206
12207
12208
|
# File 'lib/syntax_tree/node.rb', line 12206
def
@comments
end
|
Instance Method Details
#===(other) ⇒ Object
12238
12239
12240
|
# File 'lib/syntax_tree/node.rb', line 12238
def ===(other)
other.is_a?(ZSuper)
end
|
#accept(visitor) ⇒ Object
12213
12214
12215
|
# File 'lib/syntax_tree/node.rb', line 12213
def accept(visitor)
visitor.visit_zsuper(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
12217
12218
12219
|
# File 'lib/syntax_tree/node.rb', line 12217
def child_nodes
[]
end
|
#copy(location: nil) ⇒ Object
12221
12222
12223
12224
12225
12226
|
# File 'lib/syntax_tree/node.rb', line 12221
def copy(location: nil)
node = ZSuper.new(location: location || self.location)
node..concat(.map(&:copy))
node
end
|
#deconstruct_keys(_keys) ⇒ Object
12230
12231
12232
|
# File 'lib/syntax_tree/node.rb', line 12230
def deconstruct_keys(_keys)
{ location: location, comments: }
end
|
12234
12235
12236
|
# File 'lib/syntax_tree/node.rb', line 12234
def format(q)
q.text("super")
end
|