Class: RedcarpetText

Inherits:
String show all
Defined in:
lib/acts_as_markup/exts/redcarpet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#to_xml

Constructor Details

#initialize(text, options = {}) ⇒ RedcarpetText

Returns a new instance of RedcarpetText.



6
7
8
9
10
# File 'lib/acts_as_markup/exts/redcarpet.rb', line 6

def initialize(text, options = {})
  super(text)
  @text = text
  @markdown_processor = Redcarpet::Markdown.new(Redcarpet::Render::HTML, {:autolink => true}.merge(options))
end

Instance Attribute Details

#markdown_processorObject (readonly)

Returns the value of attribute markdown_processor.



4
5
6
# File 'lib/acts_as_markup/exts/redcarpet.rb', line 4

def markdown_processor
  @markdown_processor
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/acts_as_markup/exts/redcarpet.rb', line 3

def text
  @text
end

Instance Method Details

#to_htmlObject



12
13
14
# File 'lib/acts_as_markup/exts/redcarpet.rb', line 12

def to_html
  markdown_processor.render(text)
end