Class: HTMLPipeline::NodeFilter::HttpsFilter

Inherits:
HTMLPipeline::NodeFilter show all
Defined in:
lib/html_pipeline/node_filter/https_filter.rb

Overview

HTML Filter for replacing http references to :http_url with https versions. Subdomain references are not rewritten.

Context options:

:http_url - The HTTP url to force HTTPS. Falls back to :base_url

Constant Summary collapse

SELECTOR =
Selma::Selector.new(match_element: %(a[href^="http:"]))

Instance Attribute Summary

Attributes inherited from HTMLPipeline::NodeFilter

#context

Attributes inherited from Filter

#context, #result

Instance Method Summary collapse

Methods inherited from HTMLPipeline::NodeFilter

call, #html, #initialize, #reset!

Methods inherited from Filter

#base_url, #call, call, #has_ancestor?, #initialize, #needs, #validate

Constructor Details

This class inherits a constructor from HTMLPipeline::NodeFilter

Instance Method Details

#handle_element(element) ⇒ Object



17
18
19
# File 'lib/html_pipeline/node_filter/https_filter.rb', line 17

def handle_element(element)
  element["href"] = element["href"].sub(/^http:/, "https:")
end

#selectorObject



13
14
15
# File 'lib/html_pipeline/node_filter/https_filter.rb', line 13

def selector
  SELECTOR
end