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.
13152 13153 13154 13155 13156 |
# File 'lib/syntax_tree.rb', line 13152 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
13150 13151 13152 |
# File 'lib/syntax_tree.rb', line 13150 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
13147 13148 13149 |
# File 'lib/syntax_tree.rb', line 13147 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
13144 13145 13146 |
# File 'lib/syntax_tree.rb', line 13144 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
13158 13159 13160 |
# File 'lib/syntax_tree.rb', line 13158 def child_nodes [] end |
#format(q) ⇒ Object
13162 13163 13164 |
# File 'lib/syntax_tree.rb', line 13162 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 |
# File 'lib/syntax_tree.rb', line 13166 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
13177 13178 13179 13180 13181 |
# File 'lib/syntax_tree.rb', line 13177 def to_json(*opts) { type: :zsuper, value: value, loc: location, cmts: comments }.to_json( *opts ) end |