class Gmi2html::Document

Public Class Methods

new(doc) click to toggle source
# File lib/gmi2html/document.rb, line 7
def initialize(doc)
  @document_io = wrap_document(doc)
  @gemtext = parse_gemtext
end

Public Instance Methods

to_html() click to toggle source
# File lib/gmi2html/document.rb, line 12
def to_html
  renderer.to_html
end

Private Instance Methods

parse_gemtext() click to toggle source
# File lib/gmi2html/document.rb, line 22
def parse_gemtext
  ::Gemtext::Parser.new(@document_io).parse
end
renderer() click to toggle source
# File lib/gmi2html/document.rb, line 26
def renderer
  Renderer.new @gemtext.nodes
end
wrap_document(doc) click to toggle source
# File lib/gmi2html/document.rb, line 18
def wrap_document(doc)
  doc.is_a?(String) ? StringIO.new(doc) : doc
end