Permalink
Browse files

Try #to_io conversion first

  • Loading branch information...
1 parent 76f3ebe commit 9916719a74ef60a5973688d5c6c084109af5d5c6 @tarcieri tarcieri committed Feb 12, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/celluloid/io/reactor.rb
@@ -30,10 +30,10 @@ def wait_writeable(io)
def wait(io, set)
# zomg ugly type conversion :(
unless io.is_a?(::IO)
- if ::IO.respond_to? :try_convert
- io = ::IO.try_convert(io)
- elsif io.respond_to? :to_io
+ if io.respond_to? :to_io
io = io.to_io
+ elsif ::IO.respond_to? :try_convert
+ io = ::IO.try_convert(io)
end
raise TypeError, "can't convert #{io.class} into IO" unless io.is_a? IO

0 comments on commit 9916719

Please sign in to comment.