Sha256: 244342c37fc8b4647c08f0ba779a6688b902cf9a32fb156ac9da6756faaa2994
Contents?: true
Size: 523 Bytes
Versions: 144
Compression:
Stored size: 523 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) str.tr!("+/", "-_") 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
144 entries across 144 versions & 2 rubygems