Module: SymmetricEncryption::Encoder
- Defined in:
- lib/symmetric_encryption/encoder.rb
Defined Under Namespace
Classes: Base16, Base64, Base64Strict, Base64UrlSafe, None
Class Method Summary
collapse
Class Method Details
.[](encoding) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/symmetric_encryption/encoder.rb', line 3
def self.[](encoding)
case encoding
when :base64
Base64.new
when :base64strict
Base64Strict.new
when :base64urlsafe
Base64UrlSafe.new
when :base16
Base16.new
when :none
None.new
else
raise(ArgumentError, "Unknown encoder: #{encoding.inspect}")
end
end
|
.decode(encoded_string, encoding) ⇒ Object
24
25
26
|
# File 'lib/symmetric_encryption/encoder.rb', line 24
def self.decode(encoded_string, encoding)
encoder(encoding).decode(encoded_string)
end
|
.encode(binary_string, encoding) ⇒ Object
20
21
22
|
# File 'lib/symmetric_encryption/encoder.rb', line 20
def self.encode(binary_string, encoding)
encoder(encoding).encode(binary_string)
end
|