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)


175
176
177
# File 'lib/crawlscope/rules/links.rb', line 175

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

#final_pathObject



179
180
181
# File 'lib/crawlscope/rules/links.rb', line 179

def final_path
  Url.path(final_url)
end

#final_urlObject



183
184
185
186
# File 'lib/crawlscope/rules/links.rb', line 183

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

#ignored_error?Boolean

Returns:

  • (Boolean)


188
189
190
# File 'lib/crawlscope/rules/links.rb', line 188

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

#redirect?Boolean

Returns:

  • (Boolean)


196
197
198
# File 'lib/crawlscope/rules/links.rb', line 196

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

#statusObject



192
193
194
# File 'lib/crawlscope/rules/links.rb', line 192

def status
  resolution && resolution[:status]
end

#unresolved?Boolean

Returns:

  • (Boolean)


200
201
202
# File 'lib/crawlscope/rules/links.rb', line 200

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