class Loincloth

Public Class Methods

new(input_stream) click to toggle source
# File lib/loincloth.rb, line 6
def initialize(input_stream)
  input_stream = StringIO.new(input_stream) if input_stream.is_a? String
  @parser = BlockParser.new(input_stream)
end

Public Instance Methods

to_html(stream=nil) click to toggle source
# File lib/loincloth.rb, line 11
def to_html(stream=nil)
  output_stream = stream.nil? ? StringIO.new : stream
  @parser.each_block do |b|
    b.process
    output_stream << "\n" << b << "\n"
  end
  return output_stream.string if stream.nil?
end