Sha256: 5213742d8e7e2ad36da9b0c44798b664df4b9c4cd109b920d523dbf3785a9511

Contents?: true

Size: 612 Bytes

Versions: 61

Compression:

Stored size: 612 Bytes

Contents

module Ethon
  class Easy # :nodoc:

    # This module contains small helpers.
    #
    # @api private
    module Util

      # Escapes zero bytes in strings.
      #
      # @example Escape zero bytes.
      #   Util.escape_zero_byte("1\0")
      #   #=> "1\\0"
      #
      # @param [ Object ] value The value to escape.
      #
      # @return [ String, Object ] Escaped String if
      #   zero byte found, original object if not.
      def escape_zero_byte(value)
        return value unless value.to_s.include?(0.chr)
        value.to_s.gsub(0.chr, '\\\0')
      end

      extend self
    end
  end
end

Version data entries

61 entries across 60 versions & 8 rubygems

Version Path
mfk_openapi_ruby_client-1.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.54.15 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.53.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.53.17 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.53.3 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.53.1 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.52.121 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.52.92 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.52.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.52.5 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.52.0 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.51.93 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.51.38 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.51.37 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.51.34 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.51.22 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
talon_one-2.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.49.118 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/util.rb