class Html2rss::ItemExtractors::Text

Return the text of the attribute. This is the default extractor used, when no extractor is explicitly given.

Imagine this HTML structure:

<p>Lorem <b>ipsum</b> dolor ...</p>

YAML usage example:

selectors:
  description:
    selector: p
    extractor: text

Would return:

'Lorem ipsum dolor ...'

Public Class Methods

new(xml, options) click to toggle source
# File lib/html2rss/item_extractors/text.rb, line 21
def initialize(xml, options)
  @element = ItemExtractors.element(xml, options)
end

Public Instance Methods

get() click to toggle source

@return [String]

# File lib/html2rss/item_extractors/text.rb, line 27
def get
  @element.text.to_s.strip.split.join(' ')
end