Class: KStor::Crypto::ArmoredValue
- Inherits:
-
Object
- Object
- KStor::Crypto::ArmoredValue
- Defined in:
- lib/kstor/crypto/armored_value.rb
Overview
Wrapper class for an ASCII-armored value.
Direct Known Subclasses
Class Method Summary collapse
-
.from_binary(bin_str) ⇒ KStor::Crypto::ArmoredValue
Create from binary data.
Instance Method Summary collapse
-
#initialize(value) ⇒ KStor::Crypto::ArmoredValue
constructor
Create a new ASCII-armored value.
-
#to_ascii ⇒ String
(also: #to_s)
Serialize value.
-
#to_binary ⇒ String
Get back original value.
Constructor Details
#initialize(value) ⇒ KStor::Crypto::ArmoredValue
Create a new ASCII-armored value.
16 17 18 |
# File 'lib/kstor/crypto/armored_value.rb', line 16 def initialize(value) @value = value end |
Class Method Details
.from_binary(bin_str) ⇒ KStor::Crypto::ArmoredValue
Create from binary data
39 40 41 |
# File 'lib/kstor/crypto/armored_value.rb', line 39 def self.from_binary(bin_str) new(ASCIIArmor.encode(bin_str)) end |
Instance Method Details
#to_ascii ⇒ String Also known as: to_s
Serialize value.
23 24 25 |
# File 'lib/kstor/crypto/armored_value.rb', line 23 def to_ascii @value end |
#to_binary ⇒ String
Get back original value.
31 32 33 |
# File 'lib/kstor/crypto/armored_value.rb', line 31 def to_binary ASCIIArmor.decode(@value) end |