module Base64Bp
backport from ruby v2.5 to v2.2 that has no `padding` things @api private
Public Instance Methods
urlsafe_decode64(str)
click to toggle source
# File lib/graphql/schema/base_64_bp.rb, line 18 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
urlsafe_encode64(bin, padding:)
click to toggle source
# File lib/graphql/schema/base_64_bp.rb, line 12 def urlsafe_encode64(bin, padding:) str = strict_encode64(bin).tr("+/", "-_") str = str.delete("=") unless padding str end