Sha256: c5bc4c13f6abdd50e2023fdb6ac01f27e72d929e5802dde35aceab7479794d49

Contents?: true

Size: 293 Bytes

Versions: 1

Compression:

Stored size: 293 Bytes

Contents

require 'base64'
require "url_safe_base64/version"

module UrlSafeBase64
  extend self

  def encode64(str)
    Base64.encode64(str).gsub(/[\s=]+/, "").tr('+/','-_')
  end
  
  def decode64(str)
    str += '=' * (4 - str.length.modulo(4))
    Base64.decode64(str.tr('-_','+/'))
  end
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
url_safe_base64-0.2.2 lib/url_safe_base64.rb