Class: SyntaxTree::ZSuper
- Inherits:
-
Object
- Object
- SyntaxTree::ZSuper
- Defined in:
- lib/syntax_tree.rb
Overview
ZSuper represents the bare super keyword with no arguments.
super
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#location ⇒ Object
readonly
- Location
-
the location of this node.
-
#value ⇒ Object
readonly
- String
-
the value of the keyword.
Instance Method Summary collapse
- #child_nodes ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ ZSuper
constructor
A new instance of ZSuper.
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(value:, location:, comments: []) ⇒ ZSuper
Returns a new instance of ZSuper.
13672 13673 13674 13675 13676 |
# File 'lib/syntax_tree.rb', line 13672 def initialize(value:, location:, comments: []) @value = value @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
13670 13671 13672 |
# File 'lib/syntax_tree.rb', line 13670 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
13667 13668 13669 |
# File 'lib/syntax_tree.rb', line 13667 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
13664 13665 13666 |
# File 'lib/syntax_tree.rb', line 13664 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
13678 13679 13680 |
# File 'lib/syntax_tree.rb', line 13678 def child_nodes [] end |
#format(q) ⇒ Object
13682 13683 13684 |
# File 'lib/syntax_tree.rb', line 13682 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 |
# File 'lib/syntax_tree.rb', line 13686 def pretty_print(q) q.group(2, "(", ")") do q.text("zsuper") q.breakable q.pp(value) q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
13697 13698 13699 13700 13701 |
# File 'lib/syntax_tree.rb', line 13697 def to_json(*opts) { type: :zsuper, value: value, loc: location, cmts: comments }.to_json( *opts ) end |