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)


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

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

#final_pathObject



259
260
261
# File 'lib/crawlscope/rules/links.rb', line 259

def final_path
  Url.path(final_url)
end

#final_urlObject



263
264
265
266
# File 'lib/crawlscope/rules/links.rb', line 263

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

#html?Boolean

Returns:

  • (Boolean)


272
273
274
# File 'lib/crawlscope/rules/links.rb', line 272

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

#ignored_error?Boolean

Returns:

  • (Boolean)


268
269
270
# File 'lib/crawlscope/rules/links.rb', line 268

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

#noindex?Boolean

Returns:

  • (Boolean)


276
277
278
279
# File 'lib/crawlscope/rules/links.rb', line 276

def noindex?
  Crawlscope::Rules::Indexability.noindex_header?(resolution[:headers] || {}) ||
    Crawlscope::Rules::Indexability.noindex_meta?(resolution[:doc])
end

#redirect?Boolean

Returns:

  • (Boolean)


285
286
287
# File 'lib/crawlscope/rules/links.rb', line 285

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

#statusObject



281
282
283
# File 'lib/crawlscope/rules/links.rb', line 281

def status
  resolution && resolution[:status]
end

#unresolved?Boolean

Returns:

  • (Boolean)


289
290
291
# File 'lib/crawlscope/rules/links.rb', line 289

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