Class: Anchorman::HtmlConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/anchorman/html_converter.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ HtmlConverter

Returns a new instance of HtmlConverter.



3
4
5
6
7
# File 'lib/anchorman/html_converter.rb', line 3

def initialize(options)
  @path = options[:path]
  @converter = options[:converter]
  @repo = options[:repo]
end

Instance Method Details

#filenameObject



9
10
11
# File 'lib/anchorman/html_converter.rb', line 9

def filename
  "#{File.basename(@path)[0..-4]}.html"
end

#htmlObject



13
14
15
16
17
# File 'lib/anchorman/html_converter.rb', line 13

def html
  @converter.markdown(File.read(@path),
                      mode: 'gfm',
                      context: @repo.gfm_context)
end