Class: WikitextString

Inherits:
String show all
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

Instance Method Summary collapse

Methods inherited from String

#to_xml

Constructor Details

#initialize(str, *options) ⇒ WikitextString

Returns a new instance of WikitextString.



11
12
13
14
15
# File 'lib/acts_as_markup/exts/wikitext.rb', line 11

def initialize(str, *options)
  super(str)
  @text = str.to_s
  @html = Wikitext::Parser.new(*options).parse(@text)
end

Instance Attribute Details

#htmlObject (readonly)

Returns the value of attribute html.



9
10
11
# File 'lib/acts_as_markup/exts/wikitext.rb', line 9

def html
  @html
end

#textObject (readonly)

Returns the value of attribute text.



8
9
10
# File 'lib/acts_as_markup/exts/wikitext.rb', line 8

def text
  @text
end

Instance Method Details

#to_htmlObject



17
18
19
# File 'lib/acts_as_markup/exts/wikitext.rb', line 17

def to_html
  @html
end