Class: Seo::ArticleLinkAuditor::AuditResult
- Inherits:
-
Data
- Object
- Data
- Seo::ArticleLinkAuditor::AuditResult
- Defined in:
- app/services/seo/article_link_auditor.rb
Instance Attribute Summary collapse
-
#audited_at ⇒ Object
readonly
Returns the value of attribute audited_at.
-
#external_broken ⇒ Object
readonly
Returns the value of attribute external_broken.
-
#external_checked ⇒ Object
readonly
Returns the value of attribute external_checked.
-
#internal_broken ⇒ Object
readonly
Returns the value of attribute internal_broken.
-
#internal_checked ⇒ Object
readonly
Returns the value of attribute internal_checked.
Instance Method Summary collapse
- #all_valid? ⇒ Boolean
-
#initialize(internal_checked: 0, internal_broken: [], external_checked: 0, external_broken: [], audited_at: Time.current) ⇒ AuditResult
constructor
A new instance of AuditResult.
- #to_h ⇒ Object
- #total_broken ⇒ Object
Constructor Details
#initialize(internal_checked: 0, internal_broken: [], external_checked: 0, external_broken: [], audited_at: Time.current) ⇒ AuditResult
Returns a new instance of AuditResult.
25 26 27 28 29 |
# File 'app/services/seo/article_link_auditor.rb', line 25 def initialize( internal_checked: 0, internal_broken: [], external_checked: 0, external_broken: [], audited_at: Time.current ) = super |
Instance Attribute Details
#audited_at ⇒ Object (readonly)
Returns the value of attribute audited_at
20 21 22 |
# File 'app/services/seo/article_link_auditor.rb', line 20 def audited_at @audited_at end |
#external_broken ⇒ Object (readonly)
Returns the value of attribute external_broken
20 21 22 |
# File 'app/services/seo/article_link_auditor.rb', line 20 def external_broken @external_broken end |
#external_checked ⇒ Object (readonly)
Returns the value of attribute external_checked
20 21 22 |
# File 'app/services/seo/article_link_auditor.rb', line 20 def external_checked @external_checked end |
#internal_broken ⇒ Object (readonly)
Returns the value of attribute internal_broken
20 21 22 |
# File 'app/services/seo/article_link_auditor.rb', line 20 def internal_broken @internal_broken end |
#internal_checked ⇒ Object (readonly)
Returns the value of attribute internal_checked
20 21 22 |
# File 'app/services/seo/article_link_auditor.rb', line 20 def internal_checked @internal_checked end |
Instance Method Details
#all_valid? ⇒ Boolean
31 32 33 |
# File 'app/services/seo/article_link_auditor.rb', line 31 def all_valid? internal_broken.empty? && external_broken.empty? end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/services/seo/article_link_auditor.rb', line 39 def to_h { audited_at: audited_at.iso8601, internal: { checked: internal_checked, broken: internal_broken.map { |b| b.respond_to?(:to_h) ? b.to_h : b } }, external: { checked: external_checked, broken: external_broken.map { |b| b.respond_to?(:to_h) ? b.to_h : b } } } end |
#total_broken ⇒ Object
35 36 37 |
# File 'app/services/seo/article_link_auditor.rb', line 35 def total_broken internal_broken.size + external_broken.size end |