Sha256: 952c14ed69c1e731da27104c098b874705f8a36b6eae8c8a0792fcb66f849e74

Contents?: true

Size: 414 Bytes

Versions: 164

Compression:

Stored size: 414 Bytes

Contents

# Provides code to work properly on 1.8 and 1.9

class String
  unless method_defined? :bytesize
    alias_method :bytesize, :size
  end

  unless method_defined? :byteslice
    if RUBY_VERSION < '1.9'
      alias_method :byteslice, :[]
    else
      def byteslice(*arg)
        enc = self.encoding
        self.dup.force_encoding(Encoding::ASCII_8BIT).slice(*arg).force_encoding(enc)
      end
    end
  end
end

Version data entries

164 entries across 161 versions & 18 rubygems

Version Path
puma-2.7.1-java lib/puma/compat.rb
puma-2.7.1 lib/puma/compat.rb
puma-2.7.0-java lib/puma/compat.rb
puma-2.7.0 lib/puma/compat.rb