class HTML::Pipeline::HttpsFilter

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

Public Instance Methods

call() click to toggle source
# File lib/html/pipeline_plus/https_filter.rb, line 9
def call
  doc.css(%(a[href^="#{http_url}"])).each do |element|
    element['href'] = element['href'].sub(/^http:/, 'https:')
  end
  doc
end
http_url() click to toggle source

HTTP url to replace. Falls back to :base_url

# File lib/html/pipeline_plus/https_filter.rb, line 17
def http_url
  context[:http_url] || context[:base_url]
end
validate() click to toggle source

Raise error if :http_url undefined

# File lib/html/pipeline_plus/https_filter.rb, line 22
def validate
  needs :http_url unless http_url
end