Class: Crawlscope::Rules::Links::LinkTarget

Inherits:
Data
  • Object
show all
Defined in:
lib/crawlscope/rules/links.rb

Instance Method Summary collapse

Instance Method Details

#allowed?(statuses) ⇒ Boolean

Returns:

  • (Boolean)


225
226
227
# File 'lib/crawlscope/rules/links.rb', line 225

def allowed?(statuses)
  statuses.include?(status)
end

#final_pathObject



229
230
231
# File 'lib/crawlscope/rules/links.rb', line 229

def final_path
  Url.path(final_url)
end

#final_urlObject



233
234
235
236
# File 'lib/crawlscope/rules/links.rb', line 233

def final_url
  value = resolution[:final_url].to_s
  value.empty? ? target_url : value
end

#html?Boolean

Returns:

  • (Boolean)


242
243
244
# File 'lib/crawlscope/rules/links.rb', line 242

def html?
  resolution && resolution[:html]
end

#ignored_error?Boolean

Returns:

  • (Boolean)


238
239
240
# File 'lib/crawlscope/rules/links.rb', line 238

def ignored_error?
  resolution && status.nil? && resolution[:crawled] && resolution[:error]
end

#redirect?Boolean

Returns:

  • (Boolean)


250
251
252
# File 'lib/crawlscope/rules/links.rb', line 250

def redirect?
  (status && (300..399).cover?(status.to_i)) || final_url != target_url
end

#statusObject



246
247
248
# File 'lib/crawlscope/rules/links.rb', line 246

def status
  resolution && resolution[:status]
end

#unresolved?Boolean

Returns:

  • (Boolean)


254
255
256
# File 'lib/crawlscope/rules/links.rb', line 254

def unresolved?
  resolution.nil? || (status.nil? && !ignored_error?)
end