Class: KStor::Crypto::ArmoredHash
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
from_binary, #initialize, #to_ascii, #to_binary
Class Method Details
.from_hash(hash) ⇒ Object
64
65
66
|
# File 'lib/kstor/crypto/keys.rb', line 64
def self.from_hash(hash)
from_binary(hash.to_json)
end
|
Instance Method Details
#[](key) ⇒ Object
72
73
74
|
# File 'lib/kstor/crypto/keys.rb', line 72
def [](key)
to_hash[key]
end
|
#[]=(key, val) ⇒ Object
76
77
78
79
80
|
# File 'lib/kstor/crypto/keys.rb', line 76
def []=(key, val)
h = to_hash
h[key] = val
@value = ASCIIArmor.encode(h.to_json)
end
|
#to_hash ⇒ Object
68
69
70
|
# File 'lib/kstor/crypto/keys.rb', line 68
def to_hash
JSON.parse(to_binary)
end
|