Module: Roda::RodaPlugins::Base64_

Defined in:
lib/roda/plugins/_base64.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.urlsafe_decode64(str) ⇒ Object



26
27
28
# File 'lib/roda/plugins/_base64.rb', line 26

def urlsafe_decode64(str)
  decode64(str.tr("-_", "+/"))
end

.urlsafe_encode64(bin) ⇒ Object



20
21
22
23
24
# File 'lib/roda/plugins/_base64.rb', line 20

def urlsafe_encode64(bin)
  str = [bin].pack("m0")
  str.tr!("+/", "-_")
  str
end

Instance Method Details

#decode64(str) ⇒ Object

:nocov:



14
15
16
# File 'lib/roda/plugins/_base64.rb', line 14

def decode64(str)
  str.unpack1("m0")
end