Method: Base45.encode
- Defined in:
- lib/base45.rb
.encode(payload) ⇒ Object
Returns the Base45-encoded version of payload
require 'base45'
Base45.encode("Encoding in base 45 !")
Generates:
:Y8UPCAVC3/DH44M-DUJCLQE934AW6X0
26 27 28 29 30 31 32 |
# File 'lib/base45.rb', line 26 def encode(payload) return if payload.length.zero? return encode_for_single_char(payload) if payload.bytesize < 2 encode_for_multipe_chars(payload) end |