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 ⇒ IO
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.
15 16 17 |
# File 'lib/rley/formatter/base_formatter.rb', line 15 def initialize(anIO) @output = anIO end |
Instance Attribute Details
#output ⇒ IO (readonly)
The IO output stream in which the formatter's result will be sent.
10 11 12 |
# File 'lib/rley/formatter/base_formatter.rb', line 10 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.
22 23 24 25 26 |
# File 'lib/rley/formatter/base_formatter.rb', line 22 def render(aVisitor) aVisitor.subscribe(self) aVisitor.start aVisitor.unsubscribe(self) end |