Module: Base64
- Defined in:
- lib/femto_base64_for_urls.rb
Instance Method Summary collapse
Instance Method Details
#url_decode64(text) ⇒ Object
8 9 10 11 12 |
# File 'lib/femto_base64_for_urls.rb', line 8 def url_decode64(text) modulo = text.length % 4 padding = (modulo == 0) ? '' : '=' * (4 - modulo) decode64(text.gsub('-','+').gsub('_','/') + padding) end |
#url_encode64(text) ⇒ Object
4 5 6 |
# File 'lib/femto_base64_for_urls.rb', line 4 def url_encode64(text) encode64(text).chomp.gsub('=','').gsub('+','-').gsub('/','_') end |