1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/lib/puma/compat.rb

15 lines
326 B
Ruby
Raw Normal View History

# 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
2016-09-01 17:57:38 -04:00
def byteslice(*arg)
enc = self.encoding
self.dup.force_encoding(Encoding::ASCII_8BIT).slice(*arg).force_encoding(enc)
end
end
end