lib/nanoc/extra/checking/checks/external_links.rb in nanoc-3.6.7 vs lib/nanoc/extra/checking/checks/external_links.rb in nanoc-3.6.8
- old
+ new
@@ -14,20 +14,20 @@
identifiers :external_links, :elinks
def run
# Find all broken external hrefs
# TODO de-duplicate this (duplicated in internal links check)
- filenames = self.output_filenames.select { |f| File.extname(f) == '.html' }
+ filenames = output_filenames.select { |f| File.extname(f) == '.html' }
hrefs_with_filenames = ::Nanoc::Extra::LinkCollector.new(filenames, :external).filenames_per_href
- results = self.select_invalid(hrefs_with_filenames.keys)
+ results = select_invalid(hrefs_with_filenames.keys)
# Report them
results.each do |res|
filenames = hrefs_with_filenames[res.href]
filenames.each do |filename|
- self.add_issue(
- "reference to #{res.href}: #{res.explanation}",
+ add_issue(
+ "broken reference to #{res.href}: #{res.explanation}",
:subject => filename)
end
end
end
@@ -52,11 +52,11 @@
end
def next
@mutex.synchronize do
@index += 1
- return @array[@index-1]
+ return @array[@index - 1]
end
end
end
@@ -69,11 +69,11 @@
10.times do
threads << Thread.new do
loop do
href = enum.next
break if href.nil?
- res = self.validate(href)
+ res = validate(href)
if res
mutex.synchronize do
invalid << res
end
end
@@ -99,11 +99,11 @@
# Get status
res = nil
5.times do |i|
begin
- Timeout::timeout(10) do
+ Timeout.timeout(10) do
res = request_url_once(url)
if res.code == '405'
res = request_url_once(url, Net::HTTP::Get)
end
end
@@ -149,16 +149,16 @@
path
end
def request_url_once(url, req_method = Net::HTTP::Head)
- req = req_method.new(self.path_for_url(url))
+ req = req_method.new(path_for_url(url))
http = Net::HTTP.new(url.host, url.port)
if url.instance_of? URI::HTTPS
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
- res = http.request(req)
+ http.request(req)
end
end
end