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.8.18 lib/graphql/schema/base_64_bp.rb
graphql-1.10.0.pre2 lib/graphql/schema/base_64_bp.rb
graphql-1.9.16 lib/graphql/schema/base_64_bp.rb
graphql-1.9.15 lib/graphql/schema/base_64_bp.rb
graphql-1.9.14 lib/graphql/schema/base_64_bp.rb
graphql-1.10.0.pre1 lib/graphql/schema/base_64_bp.rb
graphql-1.9.13 lib/graphql/schema/base_64_bp.rb
graphql-1.9.12 lib/graphql/schema/base_64_bp.rb
graphql-1.9.11 lib/graphql/schema/base_64_bp.rb
graphql-1.9.10 lib/graphql/schema/base_64_bp.rb
graphql-1.9.9 lib/graphql/schema/base_64_bp.rb
graphql-1.9.8 lib/graphql/schema/base_64_bp.rb
graphql-1.9.7 lib/graphql/schema/base_64_bp.rb
graphql-1.9.6 lib/graphql/schema/base_64_bp.rb
graphql-1.9.5 lib/graphql/schema/base_64_bp.rb
graphql-1.9.4 lib/graphql/schema/base_64_bp.rb
graphql-1.9.3 lib/graphql/schema/base_64_bp.rb
graphql-1.9.2 lib/graphql/schema/base_64_bp.rb
graphql-1.8.17 lib/graphql/schema/base_64_bp.rb
graphql-1.8.16 lib/graphql/schema/base_64_bp.rb