Sha256: ebfc55769e255782269e4c63b136025b36a1785b1c6d6d936811b3a03487f08f

Contents?: true

Size: 698 Bytes

Versions: 11

Compression:

Stored size: 698 Bytes

Contents

module Html2rss
  module ItemExtractors
    ##
    # 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 ...'
    class Text
      def initialize(xml, options)
        @element = ItemExtractors.element(xml, options)
      end

      ##
      # @return [String]
      def get
        @element.text.to_s.strip.split.join(' ')
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
html2rss-0.9.0 lib/html2rss/item_extractors/text.rb
html2rss-0.8.2 lib/html2rss/item_extractors/text.rb
html2rss-0.8.1 lib/html2rss/item_extractors/text.rb
html2rss-0.8.0 lib/html2rss/item_extractors/text.rb
html2rss-0.7.0 lib/html2rss/item_extractors/text.rb
html2rss-0.6.0 lib/html2rss/item_extractors/text.rb
html2rss-0.5.2 lib/html2rss/item_extractors/text.rb
html2rss-0.5.1 lib/html2rss/item_extractors/text.rb
html2rss-0.5.0 lib/html2rss/item_extractors/text.rb
html2rss-0.4.1 lib/html2rss/item_extractors/text.rb
html2rss-0.4.0 lib/html2rss/item_extractors/text.rb