about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rainbows.rb2
-rw-r--r--lib/rainbows/event_machine.rb8
-rw-r--r--lib/rainbows/fiber/base.rb4
-rw-r--r--lib/rainbows/fiber/rev.rb2
-rw-r--r--lib/rainbows/http_server.rb2
-rw-r--r--lib/rainbows/rev/client.rb2
-rw-r--r--lib/rainbows/revactor.rb2
-rw-r--r--lib/rainbows/thread_pool.rb4
8 files changed, 13 insertions, 13 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index 5aae746..dd7cf1b 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -85,7 +85,7 @@ module Rainbows
     # to by the (non-frozen) Unicorn::HttpRequest::LOCALHOST constant.
     def addr(io)
       io.respond_to?(:peeraddr) ?
-                        io.peeraddr.last : Unicorn::HttpRequest::LOCALHOST
+                        io.peeraddr[-1] : Unicorn::HttpRequest::LOCALHOST
     end
 
     # the default max body size is 1 megabyte (1024 * 1024 bytes)
diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb
index 12d9e5e..e5560d3 100644
--- a/lib/rainbows/event_machine.rb
+++ b/lib/rainbows/event_machine.rb
@@ -80,7 +80,7 @@ module Rainbows
           # too tricky to support pipelining with :async since the
           # second (pipelined) request could be a stuck behind a
           # long-running async response
-          (response.nil? || -1 == response.first) and return @state = :close
+          (response.nil? || -1 == response[0]) and return @state = :close
 
           alive = @hp.keepalive? && G.alive
           out = [ alive ? CONN_ALIVE : CONN_CLOSE ] if @hp.headers?
@@ -99,7 +99,7 @@ module Rainbows
       end
 
       def response_write(response, out = [ CONN_CLOSE ], alive = false)
-        @body = body = response.last
+        @body = body = response[2]
         if body.respond_to?(:errback) && body.respond_to?(:callback)
           body.callback { quit }
           body.errback { quit }
@@ -118,7 +118,7 @@ module Rainbows
         if st.file?
           headers.delete('Transfer-Encoding')
           headers['Content-Length'] ||= st.size.to_s
-          response = [ response.first, headers.to_hash, [] ]
+          response = [ response[0], headers.to_hash, [] ]
           HttpResponse.write(self, response, out)
           stream = stream_file_data(body.to_path)
           stream.callback { quit } unless alive
@@ -130,7 +130,7 @@ module Rainbows
           else
             out[0] = CONN_CLOSE
           end
-          response = [ response.first, headers.to_hash, [] ]
+          response = [ response[0], headers.to_hash, [] ]
           HttpResponse.write(self, response, out)
           if do_chunk
             EM.watch(io, ResponseChunkPipe, self).notify_readable = true
diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb
index a056152..54f797b 100644
--- a/lib/rainbows/fiber/base.rb
+++ b/lib/rainbows/fiber/base.rb
@@ -49,7 +49,7 @@ module Rainbows
         ret[1].concat(RD.keys).each { |c| c.f.resume }
 
         # accept is an expensive syscall, filter out listeners we don't want
-        (ret.first & LISTENERS).each(&block)
+        (ret[0] & LISTENERS).each(&block)
       end
 
       # wakes up any sleepers that need to be woken and
@@ -91,7 +91,7 @@ module Rainbows
           env[REMOTE_ADDR] = remote_addr
           response = APP.call(env.update(RACK_DEFAULTS))
 
-          if 100 == response.first.to_i
+          if 100 == response[0].to_i
             client.write(EXPECT_100_RESPONSE)
             env.delete(HTTP_EXPECT)
             response = APP.call(env)
diff --git a/lib/rainbows/fiber/rev.rb b/lib/rainbows/fiber/rev.rb
index a733103..b8ec56b 100644
--- a/lib/rainbows/fiber/rev.rb
+++ b/lib/rainbows/fiber/rev.rb
@@ -91,7 +91,7 @@ module Rainbows::Fiber
           env[REMOTE_ADDR] = remote_addr
           response = APP.call(env.update(RACK_DEFAULTS))
 
-          if 100 == response.first.to_i
+          if 100 == response[0].to_i
             client.write(EXPECT_100_RESPONSE)
             env.delete(HTTP_EXPECT)
             response = APP.call(env)
diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb
index 3a30915..43604af 100644
--- a/lib/rainbows/http_server.rb
+++ b/lib/rainbows/http_server.rb
@@ -68,7 +68,7 @@ module Rainbows
 
     def worker_connections(*args)
       return @worker_connections if args.empty?
-      nr = args.first
+      nr = args[0]
       (Integer === nr && nr > 0) or
         raise ArgumentError, "worker_connections must be a positive Integer"
       @worker_connections = nr
diff --git a/lib/rainbows/rev/client.rb b/lib/rainbows/rev/client.rb
index af56889..2b2bd45 100644
--- a/lib/rainbows/rev/client.rb
+++ b/lib/rainbows/rev/client.rb
@@ -52,7 +52,7 @@ module Rainbows
       end
 
       def on_write_complete
-        if body = @deferred_bodies.first
+        if body = @deferred_bodies[0]
           return if DeferredResponse === body
           begin
             begin
diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb
index b1f0d9b..e59cb9a 100644
--- a/lib/rainbows/revactor.rb
+++ b/lib/rainbows/revactor.rb
@@ -54,7 +54,7 @@ module Rainbows
         env[Const::REMOTE_ADDR] = remote_addr
         response = app.call(env.update(RACK_DEFAULTS))
 
-        if 100 == response.first.to_i
+        if 100 == response[0].to_i
           client.write(Const::EXPECT_100_RESPONSE)
           env.delete(Const::HTTP_EXPECT)
           response = app.call(env)
diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb
index a68fcc6..6fce3c1 100644
--- a/lib/rainbows/thread_pool.rb
+++ b/lib/rainbows/thread_pool.rb
@@ -42,7 +42,7 @@ module Rainbows
     end
 
     def sync_worker
-      s = LISTENERS.first
+      s = LISTENERS[0]
       begin
         c = Rainbows.sync_accept(s) and process_client(c)
       rescue => e
@@ -57,7 +57,7 @@ module Rainbows
         # all working off the same socket could be a thundering herd
         # problem.  On the other hand, a thundering herd may not
         # even incur as much overhead as an extra Mutex#synchronize
-        ret = IO.select(LISTENERS, nil, nil, 1) and ret.first.each do |s|
+        ret = IO.select(LISTENERS, nil, nil, 1) and ret[0].each do |s|
           s = Rainbows.accept(s) and process_client(s)
         end
       rescue Errno::EINTR