Class: Raev::Article
- Inherits:
-
Object
- Object
- Raev::Article
- Defined in:
- lib/raev/article.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
Instance Method Summary collapse
-
#initialize(body) ⇒ Article
constructor
A new instance of Article.
Constructor Details
#initialize(body) ⇒ Article
Returns a new instance of Article.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/raev/article.rb', line 8 def initialize(body) body = replace_non_breaking_space(body) @doc = Nokogiri::HTML::DocumentFragment.parse(body) @doc = replace_divs_with_paragraphs(@doc) @doc = remove_empty_paragraphs(@doc) @doc = remove_extra_linebreaks(@doc) @body = @doc.to_s.gsub("\n", "") end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/raev/article.rb', line 5 def body @body end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
6 7 8 |
# File 'lib/raev/article.rb', line 6 def doc @doc end |