Sha256: cb591fce48a4ef1733e4e54e4dc3b535e17e199efbd75a6ffd9bb75fe397bc73

Contents?: true

Size: 642 Bytes

Versions: 6479

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true
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

6,479 entries across 6,477 versions & 22 rubygems

Version Path
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_id_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_bank_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_organization_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_bank_ruby-0.122.72 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_organization_ruby-0.122.72 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_id_ruby-0.122.72 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_bank_ruby-0.122.71 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_id_ruby-0.122.71 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_organization_ruby-0.122.71 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_bank_ruby-0.122.70 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_organization_ruby-0.122.70 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_id_ruby-0.122.70 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_bank_ruby-0.122.69 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_id_ruby-0.122.69 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_organization_ruby-0.122.69 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_organization_ruby-0.122.68 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_bank_ruby-0.122.68 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_id_ruby-0.122.68 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb
cybrid_api_bank_ruby-0.122.67 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/lib/ethon/easy/util.rb