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.
9876 9877 9878 9879 9880 |
# File 'lib/syntax_tree.rb', line 9876 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
9874 9875 9876 |
# File 'lib/syntax_tree.rb', line 9874 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
9871 9872 9873 |
# File 'lib/syntax_tree.rb', line 9871 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
9868 9869 9870 |
# File 'lib/syntax_tree.rb', line 9868 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
9882 9883 9884 |
# File 'lib/syntax_tree.rb', line 9882 def child_nodes [] end |
#format(q) ⇒ Object
9886 9887 9888 |
# File 'lib/syntax_tree.rb', line 9886 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 |
# File 'lib/syntax_tree.rb', line 9890 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
9901 9902 9903 9904 9905 |
# File 'lib/syntax_tree.rb', line 9901 def to_json(*opts) { type: :redo, value: value, loc: location, cmts: comments }.to_json( *opts ) end |