Sha256: 90b541e225dbc80b66f32191f7c53a2bda50be4455c0d5b3e63de3a96289baa7

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

module Html2rss
  module AttributePostProcessors
    ##
    # Returns the URI as String.
    #
    # Imagine this HTML structure:
    #
    #    <span>http://why-not-use-a-link.uh </span>
    #
    # YAML usage example:
    #
    #    selectors:
    #      link:
    #        selector: span
    #        extractor: text
    #        post_process:
    #          name: parse_uri
    #
    # Would return:
    #    'http://why-not-use-a-link.uh'
    class ParseUri
      def initialize(value, _env)
        @value = value
      end

      ##
      # @return [String]
      def get
        URI(Html2rss::Utils.sanitize_url(@value)).to_s
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
html2rss-0.9.0 lib/html2rss/attribute_post_processors/parse_uri.rb
html2rss-0.8.2 lib/html2rss/attribute_post_processors/parse_uri.rb