Sha256: fded9464c2edb80b116a70bf55706b19b5eeb1f8a1da209a5fe038854c947bde

Contents?: true

Size: 558 Bytes

Versions: 20

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

if RUBY_VERSION < "3.3.0"
  require "base64"
elsif !defined?(Base64)
  module HTTPX
    # require "base64" will not be a default gem after ruby 3.4.0
    module Base64
      module_function

      def decode64(str)
        str.unpack1("m")
      end

      def strict_encode64(bin)
        [bin].pack("m0")
      end

      def urlsafe_encode64(bin, padding: true)
        str = strict_encode64(bin)
        str.chomp!("==") or str.chomp!("=") unless padding
        str.tr!("+/", "-_")
        str
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
httpx-1.3.4 lib/httpx/base64.rb
httpx-1.3.3 lib/httpx/base64.rb
httpx-1.3.2 lib/httpx/base64.rb
httpx-1.3.1 lib/httpx/base64.rb
httpx-1.3.0 lib/httpx/base64.rb
httpx-1.2.6 lib/httpx/base64.rb
httpx-1.2.4 lib/httpx/base64.rb
httpx-1.2.3 lib/httpx/base64.rb
httpx-1.2.2 lib/httpx/base64.rb
httpx-1.2.1 lib/httpx/base64.rb
httpx-1.2.0 lib/httpx/base64.rb
httpx-1.1.5 lib/httpx/base64.rb
httpx-1.1.4 lib/httpx/base64.rb
httpx-1.1.3 lib/httpx/base64.rb
httpx-1.1.2 lib/httpx/base64.rb
httpx-1.1.1 lib/httpx/base64.rb
httpx-1.1.0 lib/httpx/base64.rb
httpx-1.0.2 lib/httpx/base64.rb
httpx-1.0.1 lib/httpx/base64.rb
httpx-1.0.0 lib/httpx/base64.rb