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

Version Path
graphql-1.9.1 lib/graphql/schema/base_64_bp.rb
graphql-1.9.0 lib/graphql/schema/base_64_bp.rb
graphql-1.8.15 lib/graphql/schema/base_64_bp.rb
graphql-1.9.0.pre4 lib/graphql/schema/base_64_bp.rb
graphql-1.8.14 lib/graphql/schema/base_64_bp.rb
graphql-1.9.0.pre3 lib/graphql/schema/base_64_bp.rb
graphql-1.9.0.pre2 lib/graphql/schema/base_64_bp.rb
graphql-1.8.13 lib/graphql/schema/base_64_bp.rb
graphql-1.8.12 lib/graphql/schema/base_64_bp.rb
graphql-1.9.0.pre1 lib/graphql/schema/base_64_bp.rb
graphql-1.8.11 lib/graphql/schema/base_64_bp.rb
graphql-1.8.10 lib/graphql/schema/base_64_bp.rb
graphql-1.8.9 lib/graphql/schema/base_64_bp.rb
graphql-1.8.8 lib/graphql/schema/base_64_bp.rb
graphql-1.8.7 lib/graphql/schema/base_64_bp.rb