Sha256: f39dfbebf3bc18cd4a7e187593b9df0f4312df0f21c8ab948ae7fcdd4553456e

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

# frozen_string_literal: true


# Superclass for parse tree formatters.
class BaseFormatter
  # The IO output stream in which the formatter's result will be sent.
  # @return [IO] The output stream for the formatter.
  attr_reader(:output)

  # Constructor.
  # @param anIO [IO] an output IO where the formatter's result will
  # be placed.
  def initialize(anIO)
    @output = anIO
  end

  # Given a parse tree visitor, perform the visit
  # and render the visit events in the output stream.
  # @param aVisitor [ParseTreeVisitor]
  def render(aVisitor)
    aVisitor.subscribe(self)
    aVisitor.start
    aVisitor.unsubscribe(self)
  end
end # class

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dendroid-0.2.00 lib/dendroid/formatters/base_formatter.rb