Class: Html2rss::AttributePostProcessors::ParseUri

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/attribute_post_processors/parse_uri.rb

Overview

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'

Instance Method Summary collapse

Constructor Details

#initialize(value, _env) ⇒ ParseUri

Returns a new instance of ParseUri.



22
23
24
# File 'lib/html2rss/attribute_post_processors/parse_uri.rb', line 22

def initialize(value, _env)
  @value = value
end

Instance Method Details

#getString

Returns:

  • (String)


28
29
30
# File 'lib/html2rss/attribute_post_processors/parse_uri.rb', line 28

def get
  URI(Html2rss::Utils.sanitize_url(@value)).to_s
end