Class: ActsAsContentHighlightable::HtmlNodeParser
- Inherits:
-
Object
- Object
- ActsAsContentHighlightable::HtmlNodeParser
- Defined in:
- lib/acts_as_content_highlightable/html_node_parser.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#parsed ⇒ Object
Returns the value of attribute parsed.
Instance Method Summary collapse
- #assign_unique_node_identifiers(attribute_name) ⇒ Object
- #body_content ⇒ Object
- #body_text ⇒ Object
-
#initialize(content) ⇒ HtmlNodeParser
constructor
A new instance of HtmlNodeParser.
Constructor Details
#initialize(content) ⇒ HtmlNodeParser
Returns a new instance of HtmlNodeParser.
3 4 5 6 |
# File 'lib/acts_as_content_highlightable/html_node_parser.rb', line 3 def initialize(content) @content = content @parsed = Nokogiri::HTML.parse(@content) end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'lib/acts_as_content_highlightable/html_node_parser.rb', line 8 def content @content end |
#parsed ⇒ Object
Returns the value of attribute parsed.
8 9 10 |
# File 'lib/acts_as_content_highlightable/html_node_parser.rb', line 8 def parsed @parsed end |
Instance Method Details
#assign_unique_node_identifiers(attribute_name) ⇒ Object
10 11 12 13 14 |
# File 'lib/acts_as_content_highlightable/html_node_parser.rb', line 10 def assign_unique_node_identifiers(attribute_name) @running_unique_identifiers = Array.new apply_unique_identifiers_to_children(@parsed, attribute_name) return self end |
#body_content ⇒ Object
16 17 18 |
# File 'lib/acts_as_content_highlightable/html_node_parser.rb', line 16 def body_content return @parsed.css('body').inner_html end |
#body_text ⇒ Object
20 21 22 |
# File 'lib/acts_as_content_highlightable/html_node_parser.rb', line 20 def body_text return @parsed.text end |