Module: Base64
- Defined in:
- lib/lorj/compat.rb
Overview
Support for encode 64 without \n
Instance Method Summary collapse
-
#strict_decode64(str) ⇒ Object
Returns the Base64-decoded version of
str. -
#strict_encode64(bin) ⇒ Object
Returns the Base64-encoded version of
bin.
Instance Method Details
#strict_decode64(str) ⇒ Object
Returns the Base64-decoded version of str.
This method complies with RFC 4648.
ArgumentError is raised if str is incorrectly padded or contains
non-alphabet characters. Note that CR or LF are also rejected.
96 97 98 |
# File 'lib/lorj/compat.rb', line 96 def strict_decode64(str) str.unpack('m0').first end |
#strict_encode64(bin) ⇒ Object
Returns the Base64-encoded version of bin.
This method complies with RFC 4648.
No line feeds are added.
88 89 90 |
# File 'lib/lorj/compat.rb', line 88 def strict_encode64(bin) [bin].pack('m0').strip end |