Class: Archaeo::CoverageReport
- Inherits:
-
Object
- Object
- Archaeo::CoverageReport
- Defined in:
- lib/archaeo/coverage_report.rb
Overview
Analyzes how thoroughly a site was archived by the Wayback Machine.
Produces coverage statistics including total URLs, archived URLs, coverage percentage, temporal gaps, and status distribution.
Instance Attribute Summary collapse
-
#archived_urls ⇒ Object
readonly
Returns the value of attribute archived_urls.
-
#missing_assets ⇒ Object
readonly
Returns the value of attribute missing_assets.
-
#status_distribution ⇒ Object
readonly
Returns the value of attribute status_distribution.
-
#temporal_gaps ⇒ Object
readonly
Returns the value of attribute temporal_gaps.
-
#total_urls ⇒ Object
readonly
Returns the value of attribute total_urls.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #as_json ⇒ Object
- #coverage_percent ⇒ Object
- #has_gaps? ⇒ Boolean
-
#initialize(url:, total_urls:, archived_urls:, status_distribution: {}, temporal_gaps: [], missing_assets: []) ⇒ CoverageReport
constructor
A new instance of CoverageReport.
- #missing_count ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(url:, total_urls:, archived_urls:, status_distribution: {}, temporal_gaps: [], missing_assets: []) ⇒ CoverageReport
Returns a new instance of CoverageReport.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/archaeo/coverage_report.rb', line 12 def initialize(url:, total_urls:, archived_urls:, status_distribution: {}, temporal_gaps: [], missing_assets: []) @url = url @total_urls = total_urls @archived_urls = archived_urls @status_distribution = status_distribution @temporal_gaps = temporal_gaps @missing_assets = missing_assets end |
Instance Attribute Details
#archived_urls ⇒ Object (readonly)
Returns the value of attribute archived_urls.
9 10 11 |
# File 'lib/archaeo/coverage_report.rb', line 9 def archived_urls @archived_urls end |
#missing_assets ⇒ Object (readonly)
Returns the value of attribute missing_assets.
9 10 11 |
# File 'lib/archaeo/coverage_report.rb', line 9 def missing_assets @missing_assets end |
#status_distribution ⇒ Object (readonly)
Returns the value of attribute status_distribution.
9 10 11 |
# File 'lib/archaeo/coverage_report.rb', line 9 def status_distribution @status_distribution end |
#temporal_gaps ⇒ Object (readonly)
Returns the value of attribute temporal_gaps.
9 10 11 |
# File 'lib/archaeo/coverage_report.rb', line 9 def temporal_gaps @temporal_gaps end |
#total_urls ⇒ Object (readonly)
Returns the value of attribute total_urls.
9 10 11 |
# File 'lib/archaeo/coverage_report.rb', line 9 def total_urls @total_urls end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/archaeo/coverage_report.rb', line 9 def url @url end |
Instance Method Details
#as_json ⇒ Object
50 51 52 |
# File 'lib/archaeo/coverage_report.rb', line 50 def as_json(*) to_h end |
#coverage_percent ⇒ Object
23 24 25 26 27 |
# File 'lib/archaeo/coverage_report.rb', line 23 def coverage_percent return 0.0 if total_urls.zero? (archived_urls.to_f / total_urls * 100).round(1) end |
#has_gaps? ⇒ Boolean
33 34 35 |
# File 'lib/archaeo/coverage_report.rb', line 33 def has_gaps? !temporal_gaps.empty? end |
#missing_count ⇒ Object
29 30 31 |
# File 'lib/archaeo/coverage_report.rb', line 29 def missing_count total_urls - archived_urls end |
#to_h ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/archaeo/coverage_report.rb', line 37 def to_h { url: @url, total_urls: @total_urls, archived_urls: @archived_urls, coverage_percent: coverage_percent, missing_count: missing_count, status_distribution: @status_distribution, temporal_gaps: @temporal_gaps, missing_assets: @missing_assets, } end |