Class: ViewSpec::Markdown
- Inherits:
-
Object
- Object
- ViewSpec::Markdown
- Defined in:
- lib/view_spec/markdown.rb
Instance Method Summary collapse
-
#initialize ⇒ Markdown
constructor
A new instance of Markdown.
- #render(text = nil, &block) ⇒ Object
Constructor Details
#initialize ⇒ Markdown
Returns a new instance of Markdown.
3 4 5 6 |
# File 'lib/view_spec/markdown.rb', line 3 def initialize renderer = ViewSpec::MarkdownRenderer.new @markdown = Redcarpet::Markdown.new(renderer, extensions) end |
Instance Method Details
#render(text = nil, &block) ⇒ Object
8 9 10 11 12 |
# File 'lib/view_spec/markdown.rb', line 8 def render(text = nil, &block) text ||= block&.call @markdown.render(text).html_safe unless text.nil? end |