Class: EncryptionKey
- Inherits:
-
Object
- Object
- EncryptionKey
- Defined in:
- lib/encryption_key.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #get(identifier) ⇒ Object
-
#initialize(data) ⇒ EncryptionKey
constructor
A new instance of EncryptionKey.
- #unlock(password) ⇒ Object
Constructor Details
#initialize(data) ⇒ EncryptionKey
Returns a new instance of EncryptionKey.
6 7 8 |
# File 'lib/encryption_key.rb', line 6 def initialize(data) @items = data['list'].map {|k| EncryptionKeyItem.new k} end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
4 5 6 |
# File 'lib/encryption_key.rb', line 4 def items @items end |
Instance Method Details
#get(identifier) ⇒ Object
14 15 16 |
# File 'lib/encryption_key.rb', line 14 def get(identifier) @items.select {|ek| ek.identifier == identifier || ek.level == identifier}.first end |
#unlock(password) ⇒ Object
10 11 12 |
# File 'lib/encryption_key.rb', line 10 def unlock(password) @items.collect {|ek| ek.unlock password}.all? end |