Class: Dropdown::MarkdownRenderer
- Inherits:
-
Object
- Object
- Dropdown::MarkdownRenderer
- Defined in:
- lib/dropdown/markdown_renderer.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#reader ⇒ Object
Returns the value of attribute reader.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ MarkdownRenderer
constructor
A new instance of MarkdownRenderer.
- #output_filename ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(file_path) ⇒ MarkdownRenderer
Returns a new instance of MarkdownRenderer.
8 9 10 11 |
# File 'lib/dropdown/markdown_renderer.rb', line 8 def initialize(file_path) @file_path = file_path @markdown = Redcarpet::Markdown.new Redcarpet::Render::HTML end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
5 6 7 |
# File 'lib/dropdown/markdown_renderer.rb', line 5 def file_path @file_path end |
#reader ⇒ Object
Returns the value of attribute reader.
6 7 8 |
# File 'lib/dropdown/markdown_renderer.rb', line 6 def reader @reader end |
Instance Method Details
#output_filename ⇒ Object
17 18 19 |
# File 'lib/dropdown/markdown_renderer.rb', line 17 def output_filename File.basename(file_path, '.md') + '.html' end |
#render ⇒ Object
13 14 15 |
# File 'lib/dropdown/markdown_renderer.rb', line 13 def render @markdown.render reader.read(file_path) end |