Class: Rley::Formatter::BaseFormatter
- Inherits:
-
Object
- Object
- Rley::Formatter::BaseFormatter
- Defined in:
- lib/rley/formatter/base_formatter.rb
Overview
Superclass for parse tree formatters.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
The IO output stream in which the formatter's result will be sent.
Instance Method Summary collapse
-
#initialize(anIO) ⇒ BaseFormatter
constructor
Constructor.
-
#render(aVisitor) ⇒ Object
Given a parse tree visitor, perform the visit and render the visit events in the output stream.
Constructor Details
#initialize(anIO) ⇒ BaseFormatter
Constructor. be placed.
12 13 14 |
# File 'lib/rley/formatter/base_formatter.rb', line 12 def initialize(anIO) @output = anIO end |
Instance Attribute Details
#output ⇒ Object (readonly)
The IO output stream in which the formatter's result will be sent.
7 8 9 |
# File 'lib/rley/formatter/base_formatter.rb', line 7 def output @output end |
Instance Method Details
#render(aVisitor) ⇒ Object
Given a parse tree visitor, perform the visit and render the visit events in the output stream.
19 20 21 22 23 |
# File 'lib/rley/formatter/base_formatter.rb', line 19 def render(aVisitor) aVisitor.subscribe(self) aVisitor.start aVisitor.unsubscribe(self) end |