Class: Html2rss::ItemExtractors::Html
- Inherits:
-
Object
- Object
- Html2rss::ItemExtractors::Html
- Defined in:
- lib/html2rss/item_extractors/html.rb
Overview
Returns the HTML content of the specified element.
Example HTML structure:
<p>Lorem <b>ipsum</b> dolor ...</p>
YAML usage example:
selectors:
description:
selector: p
extractor: html
Would return:
'<p>Lorem <b>ipsum</b> dolor ...</p>'
Always ensure to sanitize the HTML during post-processing with AttributePostProcessors::SanitizeHtml.
Defined Under Namespace
Classes: Options
Instance Method Summary collapse
-
#get ⇒ String
Retrieves and returns the HTML content of the element.
-
#initialize(xml, options) ⇒ Html
constructor
Initializes the Html extractor.
Constructor Details
#initialize(xml, options) ⇒ Html
Initializes the Html extractor.
33 34 35 |
# File 'lib/html2rss/item_extractors/html.rb', line 33 def initialize(xml, ) @element = ItemExtractors.element(xml, .selector) end |
Instance Method Details
#get ⇒ String
Retrieves and returns the HTML content of the element.
41 42 43 |
# File 'lib/html2rss/item_extractors/html.rb', line 41 def get @element.to_s end |