Class: PrettyPrint::Indent
- Inherits:
-
Object
- Object
- PrettyPrint::Indent
- Defined in:
- lib/syntax_tree/prettyprint.rb
Overview
A node in the print tree that is a variant of the Align node that indents its contents by one level.
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
Instance Method Summary collapse
-
#initialize(contents: []) ⇒ Indent
constructor
A new instance of Indent.
- #pretty_print(q) ⇒ Object
Constructor Details
#initialize(contents: []) ⇒ Indent
Returns a new instance of Indent.
200 201 202 |
# File 'lib/syntax_tree/prettyprint.rb', line 200 def initialize(contents: []) @contents = contents end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
198 199 200 |
# File 'lib/syntax_tree/prettyprint.rb', line 198 def contents @contents end |
Instance Method Details
#pretty_print(q) ⇒ Object
204 205 206 207 208 |
# File 'lib/syntax_tree/prettyprint.rb', line 204 def pretty_print(q) q.group(2, "indent([", "])") do q.seplist(contents) { |content| q.pp(content) } end end |