about summary refs log tree commit homepage
path: root/lib/rainbows/byte_slice.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rainbows/byte_slice.rb')
-rw-r--r--lib/rainbows/byte_slice.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rainbows/byte_slice.rb b/lib/rainbows/byte_slice.rb
index 09d1188..2d5586c 100644
--- a/lib/rainbows/byte_slice.rb
+++ b/lib/rainbows/byte_slice.rb
@@ -3,7 +3,7 @@ module Rainbows::ByteSlice
   if String.method_defined?(:encoding)
     def byte_slice(buf, range)
       if buf.encoding != Encoding::BINARY
-        buf.dup.force_encoding(Encoding::BINARY).slice!(range)
+        buf.dup.force_encoding(Encoding::BINARY)[range]
       else
         buf[range]
       end