Class: Mayu::EncryptedMarshal::AdditionalData
- Inherits:
-
Data
- Object
- Data
- Mayu::EncryptedMarshal::AdditionalData
- Defined in:
- lib/mayu/encrypted_marshal.rb
Instance Attribute Summary collapse
-
#issued_at ⇒ Object
readonly
Returns the value of attribute issued_at.
-
#ttl ⇒ Object
readonly
Returns the value of attribute ttl.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#issued_at ⇒ Object (readonly)
Returns the value of attribute issued_at
22 23 24 |
# File 'lib/mayu/encrypted_marshal.rb', line 22 def issued_at @issued_at end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl
22 23 24 |
# File 'lib/mayu/encrypted_marshal.rb', line 22 def ttl @ttl end |
Class Method Details
.create(ttl:, now: Time.now) ⇒ Object
24 |
# File 'lib/mayu/encrypted_marshal.rb', line 24 def self.create(ttl:, now: Time.now) = new(now.to_f, ttl) |
.unpack(data) ⇒ Object
26 27 28 29 |
# File 'lib/mayu/encrypted_marshal.rb', line 26 def self.unpack(data) data.unpack("D S") => [issued_at, ttl] new(issued_at, ttl) end |
Instance Method Details
#expired?(now: Time.now) ⇒ Boolean
32 |
# File 'lib/mayu/encrypted_marshal.rb', line 32 def expired?(now: Time.now) = now > expires_at |
#expires_at ⇒ Object
33 |
# File 'lib/mayu/encrypted_marshal.rb', line 33 def expires_at = Time.at(issued_at + ttl) |
#pack ⇒ Object
31 |
# File 'lib/mayu/encrypted_marshal.rb', line 31 def pack = [issued_at, ttl].pack("D S") |