about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-05 16:38:46 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-06 07:17:08 +0000
commitd6e4975937a9590f48dc39b1a4aefa9d62f34616 (patch)
tree241113078297e9dd11a3fdeb10769537bb40af7c
parentea6831e1eaeeb862afa7ed9213e2d9bc0180e706 (diff)
downloadrainbows-d6e4975937a9590f48dc39b1a4aefa9d62f34616.tar.gz
-rw-r--r--lib/rainbows.rb49
1 files changed, 24 insertions, 25 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index 5d9c02f..f0b5a23 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -59,36 +59,35 @@ module Rainbows
   autoload :EvCore, 'rainbows/ev_core'
   autoload :SocketProxy, 'rainbows/socket_proxy'
 
-  class << self
-
-    # Sleeps the current application dispatch.  This will pick the
-    # optimal method to sleep depending on the concurrency model chosen
-    # (which may still suck and block the entire process).  Using this
-    # with the basic :Coolio or :EventMachine models is not recommended.
-    # This should be used within your Rack application.
-    def sleep(nr)
-      case G.server.use
-      when :FiberPool, :FiberSpawn
-        Rainbows::Fiber.sleep(nr)
-      when :RevFiberSpawn, :CoolioFiberSpawn
-        Rainbows::Fiber::Coolio::Sleeper.new(nr)
-      when :Revactor
-        Actor.sleep(nr)
-      else
-        Kernel.sleep(nr)
-      end
+  # Sleeps the current application dispatch.  This will pick the
+  # optimal method to sleep depending on the concurrency model chosen
+  # (which may still suck and block the entire process).  Using this
+  # with the basic :Coolio or :EventMachine models is not recommended.
+  # This should be used within your Rack application.
+  def self.sleep(nr)
+    case G.server.use
+    when :FiberPool, :FiberSpawn
+      Rainbows::Fiber.sleep(nr)
+    when :RevFiberSpawn, :CoolioFiberSpawn
+      Rainbows::Fiber::Coolio::Sleeper.new(nr)
+    when :Revactor
+      Actor.sleep(nr)
+    else
+      Kernel.sleep(nr)
     end
+  end
 
-    # runs the Rainbows! HttpServer with +app+ and +options+ and does
-    # not return until the server has exited.
-    def run(app, options = {}) # :nodoc:
-      HttpServer.new(app, options).start.join
-    end
+  # runs the Rainbows! HttpServer with +app+ and +options+ and does
+  # not return until the server has exited.
+  def self.run(app, options = {}) # :nodoc:
+    HttpServer.new(app, options).start.join
+  end
 
-    # :stopdoc:
+  # :stopdoc:
+  class << self
     attr_accessor :max_bytes, :keepalive_timeout
-    # :startdoc:
   end
+  # :startdoc:
 
   # the default max body size is 1 megabyte (1024 * 1024 bytes)
   @max_bytes = 1024 * 1024