about summary refs log tree commit homepage
path: root/lib/rainbows/error.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-04 20:39:41 -0800
committerEric Wong <normalperson@yhbt.net>2011-02-04 20:39:41 -0800
commit7246d2f2d1601dbb5486ce7f9ddbebd1bb975b58 (patch)
treefd2c407b4c9bed38fbfc2d586a3c5c905954045a /lib/rainbows/error.rb
parente00c2e8c53ad5b47baa5bc6a8765b7c3c92296b9 (diff)
downloadrainbows-7246d2f2d1601dbb5486ce7f9ddbebd1bb975b58.tar.gz
We want to use the singleton methods in Kgio to reduce
conditionals.
Diffstat (limited to 'lib/rainbows/error.rb')
-rw-r--r--lib/rainbows/error.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/rainbows/error.rb b/lib/rainbows/error.rb
index 98de6ba..039af9d 100644
--- a/lib/rainbows/error.rb
+++ b/lib/rainbows/error.rb
@@ -7,13 +7,7 @@ module Rainbows::Error
   # if the socket is already closed or broken.  We'll always ensure
   # the socket is closed at the end of this function
   def self.write(io, e)
-    if msg = response(e)
-      if io.respond_to?(:kgio_trywrite)
-        io.kgio_trywrite(msg)
-      else
-        io.write_nonblock(msg)
-      end
-    end
+    msg = response(e) and Kgio.trywrite(io, msg)
     rescue
   end