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.
13967 13968 13969 13970 13971 |
# File 'lib/syntax_tree.rb', line 13967 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
13965 13966 13967 |
# File 'lib/syntax_tree.rb', line 13965 def comments @comments end |
#location ⇒ Object (readonly)
[Location] the location of this node
13962 13963 13964 |
# File 'lib/syntax_tree.rb', line 13962 def location @location end |
#value ⇒ Object (readonly)
[String] the value of the keyword
13959 13960 13961 |
# File 'lib/syntax_tree.rb', line 13959 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
13973 13974 13975 |
# File 'lib/syntax_tree.rb', line 13973 def child_nodes [] end |
#format(q) ⇒ Object
13977 13978 13979 |
# File 'lib/syntax_tree.rb', line 13977 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 |
# File 'lib/syntax_tree.rb', line 13981 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
13992 13993 13994 13995 13996 |
# File 'lib/syntax_tree.rb', line 13992 def to_json(*opts) { type: :zsuper, value: value, loc: location, cmts: comments }.to_json( *opts ) end |