about summary refs log tree commit homepage
path: root/lib/rainbows/byte_slice.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-09-28 17:40:01 -0700
committerEric Wong <normalperson@yhbt.net>2010-09-28 17:40:01 -0700
commitad821f70a2488a91f2be1ac53cb2e64f50743989 (patch)
tree6db4d334106360305ba3b66b643e8694f232fa10 /lib/rainbows/byte_slice.rb
parent11c75ec06ce72cea0c760161dc01a196500aa293 (diff)
downloadrainbows-ad821f70a2488a91f2be1ac53cb2e64f50743989.tar.gz
It removes the burden of byte slicing and setting file
descriptor flags.  In some cases, we can remove unnecessary
peeraddr calls, too.
Diffstat (limited to 'lib/rainbows/byte_slice.rb')
-rw-r--r--lib/rainbows/byte_slice.rb17
1 files changed, 0 insertions, 17 deletions
diff --git a/lib/rainbows/byte_slice.rb b/lib/rainbows/byte_slice.rb
deleted file mode 100644
index 3bb4dd7..0000000
--- a/lib/rainbows/byte_slice.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- encoding: binary -*-
-# :enddoc:
-module Rainbows::ByteSlice
-  if String.method_defined?(:encoding)
-    def byte_slice(buf, range)
-      if buf.encoding != Encoding::BINARY
-        buf.dup.force_encoding(Encoding::BINARY)[range]
-      else
-        buf[range]
-      end
-    end
-  else
-    def byte_slice(buf, range)
-      buf[range]
-    end
-  end
-end