Class: Refract::Formatter
- Inherits:
-
BasicVisitor
- Object
- BasicVisitor
- Refract::Formatter
- Defined in:
- lib/refract/formatter.rb
Constant Summary collapse
- Result =
Data.define(:source, :source_map)
Instance Method Summary collapse
- #around_visit(node) ⇒ Object
- #format_node(node) ⇒ Object
-
#initialize(starting_line: 1) ⇒ Formatter
constructor
A new instance of Formatter.
Methods inherited from BasicVisitor
Constructor Details
#initialize(starting_line: 1) ⇒ Formatter
Returns a new instance of Formatter.
7 8 9 10 11 12 13 |
# File 'lib/refract/formatter.rb', line 7 def initialize(starting_line: 1) super() @buffer = [] @source_map = [] @current_line = starting_line @indent = 0 end |
Instance Method Details
#around_visit(node) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/refract/formatter.rb', line 15 def around_visit(node) if (start_line = node.start_line) @source_map[@current_line] = start_line end super end |