Class: SyntaxTree::Redo
- Inherits:
-
Object
- Object
- SyntaxTree::Redo
- Defined in:
- lib/syntax_tree.rb
Overview
Redo represents the use of the redo keyword.
redo
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: []) ⇒ Redo
constructor
A new instance of Redo.
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Redo
Returns a new instance of Redo.
10008 10009 10010 10011 10012 |
# File 'lib/syntax_tree.rb', line 10008 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
10006 10007 10008 |
# File 'lib/syntax_tree.rb', line 10006 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
10003 10004 10005 |
# File 'lib/syntax_tree.rb', line 10003 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
10000 10001 10002 |
# File 'lib/syntax_tree.rb', line 10000 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
10014 10015 10016 |
# File 'lib/syntax_tree.rb', line 10014 def child_nodes [] end |
#format(q) ⇒ Object
10018 10019 10020 |
# File 'lib/syntax_tree.rb', line 10018 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 |
# File 'lib/syntax_tree.rb', line 10022 def pretty_print(q) q.group(2, "(", ")") do q.text("redo") q.breakable q.pp(value) q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
10033 10034 10035 10036 10037 |
# File 'lib/syntax_tree.rb', line 10033 def to_json(*opts) { type: :redo, value: value, loc: location, cmts: comments }.to_json( *opts ) end |