Class: Sigstore::TUF::Snapshot
- Inherits:
-
Object
- Object
- Sigstore::TUF::Snapshot
- Defined in:
- lib/sigstore/tuf/snapshot.rb
Overview
The class for the Snapshot role
Defined Under Namespace
Classes: Meta
Constant Summary collapse
- TYPE =
"snapshot"
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #expired?(reference_time) ⇒ Boolean
-
#initialize(data) ⇒ Snapshot
constructor
A new instance of Snapshot.
Constructor Details
#initialize(data) ⇒ Snapshot
Returns a new instance of Snapshot.
26 27 28 29 30 31 32 33 |
# File 'lib/sigstore/tuf/snapshot.rb', line 26 def initialize(data) type = data.fetch("_type") raise Error::InvalidData, "Expected type to be #{TYPE}, got #{type.inspect}" unless type == TYPE @version = data.fetch("version") @expires = Time.iso8601 data.fetch("expires") = data.fetch("meta").transform_values { Meta.from_hash(_1) } end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
24 25 26 |
# File 'lib/sigstore/tuf/snapshot.rb', line 24 def end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
24 25 26 |
# File 'lib/sigstore/tuf/snapshot.rb', line 24 def version @version end |
Instance Method Details
#expired?(reference_time) ⇒ Boolean
35 36 37 |
# File 'lib/sigstore/tuf/snapshot.rb', line 35 def expired?(reference_time) @expires < reference_time end |