Class: Highlights::Renderer

Inherits:
Object
  • Object
show all
Includes:
Formatter::HTML, Formatter::Markdown
Defined in:
lib/highlights/renderer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Formatter::Markdown

#render_markdown

Methods included from Formatter::HTML

#render_html

Constructor Details

#initialize(document, outfile) ⇒ Renderer

Returns a new instance of Renderer.



6
7
8
9
# File 'lib/highlights/renderer.rb', line 6

def initialize(document, outfile)
  @document = document
  @outfile = outfile
end

Class Method Details

.render(*args) ⇒ Object



11
12
13
# File 'lib/highlights/renderer.rb', line 11

def self.render(*args)
  new(*args).render
end

Instance Method Details

#renderObject



15
16
17
18
19
20
21
22
# File 'lib/highlights/renderer.rb', line 15

def render
  case File.extname(@outfile)
  when '.md', '.markdown'
    render_markdown
  when '.html'
    render_html
  end
end