Class: Perron::HtmlProcessor::AbsoluteUrls

Inherits:
Base
  • Object
show all
Defined in:
lib/perron/html_processor/absolute_urls.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Perron::HtmlProcessor::Base

Instance Method Details

#processObject



6
7
8
9
10
11
12
13
14
# File 'lib/perron/html_processor/absolute_urls.rb', line 6

def process
  @html.css("img").each do |image|
    src = image["src"]

    next if src.blank? || absolute_url?(src)

    image["src"] = base_url + src
  end
end