Class: EncryptionKey

Inherits:
Object
  • Object
show all
Defined in:
lib/encryption_key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#itemsObject (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