about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-10 13:34:58 -0800
committerEric Wong <normalperson@yhbt.net>2011-02-10 13:34:58 -0800
commit6dd90cb902f43b32b0db204484d5e3df79ec0d0c (patch)
treefb09529a54707bbb7e9993e30f4ab95e5e3db68e
parent1fd1234ca5ba3d84d2182c38b37322bd55f08882 (diff)
downloadunicorn-6dd90cb902f43b32b0db204484d5e3df79ec0d0c.tar.gz
remove unnecessary &block usage
They needlessly allocate Proc objects
-rw-r--r--lib/unicorn/app/exec_cgi.rb2
-rw-r--r--lib/unicorn/app/inetd.rb2
-rw-r--r--lib/unicorn/oob_gc.rb4
-rw-r--r--lib/unicorn/stream_input.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb
index c259403..ac16755 100644
--- a/lib/unicorn/app/exec_cgi.rb
+++ b/lib/unicorn/app/exec_cgi.rb
@@ -33,7 +33,7 @@ module Unicorn::App
         sysseek(@body_offset = n)
       end
 
-      def each(&block)
+      def each
         sysseek @body_offset
         # don't use a preallocated buffer for sysread since we can't
         # guarantee an actual socket is consuming the yielded string
diff --git a/lib/unicorn/app/inetd.rb b/lib/unicorn/app/inetd.rb
index 9bfa7cb..2cc280c 100644
--- a/lib/unicorn/app/inetd.rb
+++ b/lib/unicorn/app/inetd.rb
@@ -47,7 +47,7 @@ module Unicorn::App
         }
       end
 
-      def each(&block)
+      def each
         begin
           rd, = IO.select([err_rd, out_rd])
           rd && rd.first or next
diff --git a/lib/unicorn/oob_gc.rb b/lib/unicorn/oob_gc.rb
index 8dc4dcf..402d4ed 100644
--- a/lib/unicorn/oob_gc.rb
+++ b/lib/unicorn/oob_gc.rb
@@ -38,8 +38,8 @@ module Unicorn
       [ status, headers, self ]
     end
 
-    def each(&block)
-      body.each(&block)
+    def each
+      body.each { |x| yield x }
     end
 
     # in Unicorn, this is closed _after_ the client socket
diff --git a/lib/unicorn/stream_input.rb b/lib/unicorn/stream_input.rb
index fa2e902..90e1d6e 100644
--- a/lib/unicorn/stream_input.rb
+++ b/lib/unicorn/stream_input.rb
@@ -93,7 +93,7 @@ class Unicorn::StreamInput
   #
   # Executes the block for every ``line'' in *ios*, where lines are
   # separated by the global record separator ($/, typically "\n").
-  def each(&block)
+  def each
     while line = gets
       yield line
     end