Class: Html2rss::ItemExtractors::Html

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/item_extractors/html.rb

Overview

Return the HTML of the attribute.

Imagine this 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 make sure to sanitize the HTML during post processing with AttributePostProcessors::SanitizeHtml.

Instance Method Summary collapse

Constructor Details

#initialize(xml, options) ⇒ Html

Returns a new instance of Html



23
24
25
# File 'lib/html2rss/item_extractors/html.rb', line 23

def initialize(xml, options)
  @element = ItemExtractors.element(xml, options)
end

Instance Method Details

#getString

Returns:

  • (String)


29
30
31
# File 'lib/html2rss/item_extractors/html.rb', line 29

def get
  @element.to_s
end