Class: Ucode::Fetch::FontFetcher::Result
- Inherits:
-
Struct
- Object
- Struct
- Ucode::Fetch::FontFetcher::Result
- Defined in:
- lib/ucode/fetch/font_fetcher/result.rb
Overview
Typed outcome of fetching one font. The fetcher never raises
for a single font failure; it returns a :failed Result so
the aggregate run can keep going and report every problem.
Statuses:
:downloaded— fetched this run; bytes are on disk atpath.:skipped— already present with matching SHA256 (or dry-run).:failed— license refused, checksum mismatch, network error, or zip extraction error.erroris set.:local—url: null; the user supplies the file. May or may not be present yet (seenote).:planned— dry-run only; this entry would have been fetched.
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#label ⇒ Object
Returns the value of attribute label.
-
#license ⇒ Object
Returns the value of attribute license.
-
#note ⇒ Object
Returns the value of attribute note.
-
#path ⇒ Object
Returns the value of attribute path.
-
#provenance ⇒ Object
Returns the value of attribute provenance.
-
#size_bytes ⇒ Object
Returns the value of attribute size_bytes.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #downloaded? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(status:, **opts) ⇒ Result
constructor
A new instance of Result.
- #local? ⇒ Boolean
- #planned? ⇒ Boolean
- #skipped? ⇒ Boolean
Constructor Details
#initialize(status:, **opts) ⇒ Result
Returns a new instance of Result.
23 24 25 26 27 28 29 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 23 def initialize(status:, **opts) unless STATUSES.include?(status) raise ArgumentError, "unknown FontFetcher::Result status: #{status.inspect}" end super end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def error @error end |
#label ⇒ Object
Returns the value of attribute label
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def label @label end |
#license ⇒ Object
Returns the value of attribute license
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def license @license end |
#note ⇒ Object
Returns the value of attribute note
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def note @note end |
#path ⇒ Object
Returns the value of attribute path
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def path @path end |
#provenance ⇒ Object
Returns the value of attribute provenance
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def provenance @provenance end |
#size_bytes ⇒ Object
Returns the value of attribute size_bytes
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def size_bytes @size_bytes end |
#status ⇒ Object
Returns the value of attribute status
21 22 23 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 21 def status @status end |
Instance Method Details
#downloaded? ⇒ Boolean
31 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 31 def downloaded? = status == :downloaded |
#failed? ⇒ Boolean
33 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 33 def failed? = status == :failed |
#local? ⇒ Boolean
34 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 34 def local? = status == :local |
#planned? ⇒ Boolean
35 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 35 def planned? = status == :planned |
#skipped? ⇒ Boolean
32 |
# File 'lib/ucode/fetch/font_fetcher/result.rb', line 32 def skipped? = status == :skipped |