Sha256: de3e509210b7f1b3ca76674ee7ac4795f611aa9fc2b7bc91686d1623d10cc194
Contents?: true
Size: 519 Bytes
Versions: 35
Compression:
Stored size: 519 Bytes
Contents
# frozen_string_literal: true require 'base64' # backport from ruby v2.5 to v2.2 that has no `padding` things # @api private module Base64Bp extend Base64 module_function def urlsafe_encode64(bin, padding:) str = strict_encode64(bin).tr("+/", "-_") str = str.delete("=") unless padding str end def urlsafe_decode64(str) str = str.tr("-_", "+/") if !str.end_with?("=") && str.length % 4 != 0 str = str.ljust((str.length + 3) & ~3, "=") end strict_decode64(str) end end
Version data entries
35 entries across 35 versions & 1 rubygems