Class: Article
- Inherits:
-
Struct
- Object
- Struct
- Article
- Defined in:
- lib/wp/wiki.rb
Instance Attribute Summary collapse
-
#redirect ⇒ Object
Returns the value of attribute redirect.
-
#redirected_from ⇒ Object
Returns the value of attribute redirected_from.
-
#text ⇒ Object
Returns the value of attribute text.
-
#title ⇒ Object
Returns the value of attribute title.
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(page) ⇒ Article
constructor
A new instance of Article.
- #redirect? ⇒ Boolean
- #to_html ⇒ Object (also: #html)
Constructor Details
#initialize(page) ⇒ Article
Returns a new instance of Article.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/wp/wiki.rb', line 30 def initialize(page) self.xml = page self.title = page.at("title").text if redirect = page.at("redirect") self.redirect = redirect["title"] else self.text = page.at("text").text end end |
Instance Attribute Details
#redirect ⇒ Object
Returns the value of attribute redirect
28 29 30 |
# File 'lib/wp/wiki.rb', line 28 def redirect @redirect end |
#redirected_from ⇒ Object
Returns the value of attribute redirected_from
28 29 30 |
# File 'lib/wp/wiki.rb', line 28 def redirected_from @redirected_from end |
#text ⇒ Object
Returns the value of attribute text
28 29 30 |
# File 'lib/wp/wiki.rb', line 28 def text @text end |
#title ⇒ Object
Returns the value of attribute title
28 29 30 |
# File 'lib/wp/wiki.rb', line 28 def title @title end |
#xml ⇒ Object
Returns the value of attribute xml
28 29 30 |
# File 'lib/wp/wiki.rb', line 28 def xml @xml end |
Instance Method Details
#redirect? ⇒ Boolean
42 43 44 |
# File 'lib/wp/wiki.rb', line 42 def redirect? !!redirect end |
#to_html ⇒ Object Also known as: html
47 48 49 50 |
# File 'lib/wp/wiki.rb', line 47 def to_html # WikiCloth::Parser.new(data: text).to_html WikiParser.new(data: text).to_html end |