Class: Crawlscope::Rules::Links::LinkTarget
- Inherits:
-
Data
- Object
- Data
- Crawlscope::Rules::Links::LinkTarget
- Defined in:
- lib/crawlscope/rules/links.rb
Instance Method Summary collapse
- #allowed?(statuses) ⇒ Boolean
- #final_path ⇒ Object
- #final_url ⇒ Object
- #html? ⇒ Boolean
- #ignored_error? ⇒ Boolean
- #redirect? ⇒ Boolean
- #status ⇒ Object
- #unresolved? ⇒ Boolean
Instance Method Details
#allowed?(statuses) ⇒ Boolean
225 226 227 |
# File 'lib/crawlscope/rules/links.rb', line 225 def allowed?(statuses) statuses.include?(status) end |
#final_path ⇒ Object
229 230 231 |
# File 'lib/crawlscope/rules/links.rb', line 229 def final_path Url.path(final_url) end |
#final_url ⇒ Object
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
242 243 244 |
# File 'lib/crawlscope/rules/links.rb', line 242 def html? resolution && resolution[:html] end |
#ignored_error? ⇒ 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
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 |
#status ⇒ Object
246 247 248 |
# File 'lib/crawlscope/rules/links.rb', line 246 def status resolution && resolution[:status] end |
#unresolved? ⇒ Boolean
254 255 256 |
# File 'lib/crawlscope/rules/links.rb', line 254 def unresolved? resolution.nil? || (status.nil? && !ignored_error?) end |