Class: PrettierPrint::Align
- Inherits:
-
Object
- Object
- PrettierPrint::Align
- Defined in:
- lib/prettier_print.rb
Overview
A node in the print tree that represents aligning nested nodes to a certain prefix width or string.
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#indent ⇒ Object
readonly
Returns the value of attribute indent.
Instance Method Summary collapse
-
#initialize(indent:, contents: []) ⇒ Align
constructor
A new instance of Align.
- #pretty_print(q) ⇒ Object
Constructor Details
#initialize(indent:, contents: []) ⇒ Align
Returns a new instance of Align.
68 69 70 71 |
# File 'lib/prettier_print.rb', line 68 def initialize(indent:, contents: []) @indent = indent @contents = contents end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
66 67 68 |
# File 'lib/prettier_print.rb', line 66 def contents @contents end |
#indent ⇒ Object (readonly)
Returns the value of attribute indent.
66 67 68 |
# File 'lib/prettier_print.rb', line 66 def indent @indent end |
Instance Method Details
#pretty_print(q) ⇒ Object
73 74 75 76 77 |
# File 'lib/prettier_print.rb', line 73 def pretty_print(q) q.group(2, "align#{indent}([", "])") do q.seplist(contents) { |content| q.pp(content) } end end |