lib/awesome_bot/statuses.rb in awesome_bot-1.5.0 vs lib/awesome_bot/statuses.rb in awesome_bot-1.5.1

- old
+ new

@@ -16,16 +16,21 @@ def net_status(url, head) head ? net_head_status(url) : net_get_status(url) end + def status_is_redirected?(status) + (status > 299) && (status < 400) + end + def statuses(links, threads, head = false) statuses = [] Parallel.each(links, in_threads: threads) do |u| begin response = net_status u, head status = response.status headers = response.headers + error = nil # nil (success) rescue => e status = STATUS_ERROR headers = {} error = e end