Class: HTML::Pipeline::HttpsFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/html/pipeline/https_filter.rb

Overview

HTML Filter for replacing http github urls with https versions.

Instance Attribute Summary

Attributes inherited from Filter

#context, #result

Instance Method Summary collapse

Methods inherited from Filter

#base_url, call, #can_access_repo?, #current_user, #doc, #has_ancestor?, #html, #initialize, #needs, #parse_html, #repository, to_document, to_html, #validate

Constructor Details

This class inherits a constructor from HTML::Pipeline::Filter

Instance Method Details

#callObject



5
6
7
8
9
10
# File 'lib/html/pipeline/https_filter.rb', line 5

def call
  doc.css('a[href^="http://github.com"]').each do |element|
    element['href'] = element['href'].sub(/^http:/,'https:')
  end
  doc
end