Class: ViewSpec::Markdown

Inherits:
Object
  • Object
show all
Defined in:
lib/view_spec/markdown.rb

Instance Method Summary collapse

Constructor Details

#initializeMarkdown

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