Module: Base64Bp Private

Extended by:
Base64
Defined in:
lib/graphql/schema/base_64_bp.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

backport from ruby v2.5 to v2.2 that has no padding things

Class Method Summary collapse

Class Method Details

.urlsafe_decode64(str) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
24
# 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:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
15
16
# 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