class GhostWriter::Writer

Public Class Methods

new(document, options = {}) click to toggle source
# File lib/ghost_writer/writer.rb, line 7
def initialize(document, options = {})
  @document  = document
  @format    = options.delete(:format) || :markdown
  @options   = options
end

Public Instance Methods

write_file() click to toggle source
# File lib/ghost_writer/writer.rb, line 13
def write_file
  format_class = lookup_format_class
  format = format_class.new(@document, @options)
  format.write_file
end

Private Instance Methods

lookup_format_class() click to toggle source
# File lib/ghost_writer/writer.rb, line 21
def lookup_format_class
  case @format
  when Class
    @format
  when String, Symbol
    "GhostWriter::Writer::#{@format.to_s.classify}".constantize
  end
end