Sha256: 15d56a22e215966f98371a24a65e85ed018cef3afc8e1f56112a8b10f1deef9d

Contents?: true

Size: 893 Bytes

Versions: 15

Compression:

Stored size: 893 Bytes

Contents

# frozen_string_literal: true

module Rley # This module is used as a namespace
  # Namespace dedicated to parse tree formatters.
  module Formatter
    # 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
  end # module
end # module

# End of file

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rley-0.8.11 lib/rley/formatter/base_formatter.rb
rley-0.8.10 lib/rley/formatter/base_formatter.rb
rley-0.8.09 lib/rley/formatter/base_formatter.rb
rley-0.8.08 lib/rley/formatter/base_formatter.rb
rley-0.8.06 lib/rley/formatter/base_formatter.rb
rley-0.8.05 lib/rley/formatter/base_formatter.rb
rley-0.8.03 lib/rley/formatter/base_formatter.rb
rley-0.8.02 lib/rley/formatter/base_formatter.rb
rley-0.8.01 lib/rley/formatter/base_formatter.rb
rley-0.8.00 lib/rley/formatter/base_formatter.rb
rley-0.7.08 lib/rley/formatter/base_formatter.rb
rley-0.7.07 lib/rley/formatter/base_formatter.rb
rley-0.7.06 lib/rley/formatter/base_formatter.rb
rley-0.7.05 lib/rley/formatter/base_formatter.rb
rley-0.7.04 lib/rley/formatter/base_formatter.rb