Sha256: 66ad9e35421e9044b3f77de505c20587d233d12f1c40fa15a16aec9a27aee287

Contents?: true

Size: 302 Bytes

Versions: 6

Compression:

Stored size: 302 Bytes

Contents

# Adds urlsafe_encode64 and urlsafe_decode64 for Ruby 1.8.
if RUBY_VERSION < '1.9'
  module Base64
    module_function

    def urlsafe_encode64(str)
      [str].pack("m0").tr("\n",'').tr("+/", "-_")
    end

    def urlsafe_decode64(str)
      str.tr("-_", "+/").unpack("m0").first
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cifrado-0.2.1 lib/cifrado/core_ext/ruby18_base64.rb
cifrado-0.2.0 lib/cifrado/core_ext/ruby18_base64.rb
cifrado-0.1.3 lib/cifrado/core_ext/ruby18_base64.rb
cifrado-0.1.2 lib/cifrado/core_ext/ruby18_base64.rb
cifrado-0.1.1 lib/cifrado/core_ext/ruby18_base64.rb
cifrado-0.1 lib/cifrado/core_ext/ruby18_base64.rb