Class: SyntaxTree::Super
Overview
Super represents using the super keyword with arguments. It can optionally use parentheses.
super(value)
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
- ArgParen | Args
-
the arguments to the keyword.
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(arguments:, location:, comments: []) ⇒ Super
constructor
A new instance of Super.
Methods inherited from Node
Constructor Details
#initialize(arguments:, location:, comments: []) ⇒ Super
Returns a new instance of Super.
7683 7684 7685 7686 7687 |
# File 'lib/syntax_tree/node.rb', line 7683 def initialize(arguments:, location:, comments: []) @arguments = arguments @location = location @comments = comments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
- ArgParen | Args
-
the arguments to the keyword
7678 7679 7680 |
# File 'lib/syntax_tree/node.rb', line 7678 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
7681 7682 7683 |
# File 'lib/syntax_tree/node.rb', line 7681 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
7689 7690 7691 |
# File 'lib/syntax_tree/node.rb', line 7689 def accept(visitor) visitor.visit_super(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7693 7694 7695 |
# File 'lib/syntax_tree/node.rb', line 7693 def child_nodes [arguments] end |
#deconstruct_keys(keys) ⇒ Object
7699 7700 7701 |
# File 'lib/syntax_tree/node.rb', line 7699 def deconstruct_keys(keys) { arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 |
# File 'lib/syntax_tree/node.rb', line 7703 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 |