Class: WikitextString

Inherits:
String
  • Object
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

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

#htmlObject (readonly)

Returns the value of attribute html.



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

def html
  @html
end

#textObject (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_htmlObject



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

def to_html
  @html
end