Class: WikitextString
- Inherits:
-
String
- Object
- String
- WikitextString
- Defined in:
- lib/acts_as_markup/exts/wikitext.rb
Overview
This allows a us to create a wrapper object similar to those provided by the Markdown and Textile libraries. It stores the original and formated HTML text in instance variables.
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(str) ⇒ WikitextString
constructor
A new instance of WikitextString.
- #to_html ⇒ Object
Constructor Details
#initialize(str) ⇒ WikitextString
Returns a new instance of WikitextString.
12 13 14 15 16 |
# File 'lib/acts_as_markup/exts/wikitext.rb', line 12 def initialize(str) super(str) @text = str.to_s @html = Wikitext::Parser.new.parse(@text) end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
10 11 12 |
# File 'lib/acts_as_markup/exts/wikitext.rb', line 10 def html @html end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
9 10 11 |
# File 'lib/acts_as_markup/exts/wikitext.rb', line 9 def text @text end |
Instance Method Details
#to_html ⇒ Object
18 19 20 |
# File 'lib/acts_as_markup/exts/wikitext.rb', line 18 def to_html @html end |