class HTML::Pipeline::RelativeLinksFilter
HTML
Filter
for replacing http and https urls with protocol relative versions.
Public Instance Methods
call()
click to toggle source
# File lib/html/pipeline/relative_links_filter.rb, line 7 def call h = context[:host] doc.css("a[href^=\"http://#{h}\"],a[href^=\"https://#{h}\"]").each do |element| element['href'] = element['href'].sub(/^https?:/, '') end doc end