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
- #noindex? ⇒ Boolean
- #redirect? ⇒ Boolean
- #status ⇒ Object
- #unresolved? ⇒ Boolean
Instance Method Details
#allowed?(statuses) ⇒ Boolean
255 256 257 |
# File 'lib/crawlscope/rules/links.rb', line 255 def allowed?(statuses) statuses.include?(status) end |
#final_path ⇒ Object
259 260 261 |
# File 'lib/crawlscope/rules/links.rb', line 259 def final_path Url.path(final_url) end |
#final_url ⇒ Object
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
272 273 274 |
# File 'lib/crawlscope/rules/links.rb', line 272 def html? resolution && resolution[:html] end |
#ignored_error? ⇒ 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
276 277 278 279 |
# File 'lib/crawlscope/rules/links.rb', line 276 def noindex? Crawlscope::Rules::Indexability.noindex_header?(resolution[:headers] || {}) || Crawlscope::Rules::Indexability.(resolution[:doc]) end |
#redirect? ⇒ 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 |
#status ⇒ Object
281 282 283 |
# File 'lib/crawlscope/rules/links.rb', line 281 def status resolution && resolution[:status] end |
#unresolved? ⇒ Boolean
289 290 291 |
# File 'lib/crawlscope/rules/links.rb', line 289 def unresolved? resolution.nil? || (status.nil? && !ignored_error?) end |