about summary refs log tree commit homepage
path: root/lib/rainbows/rev_fiber_spawn.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-10-22 16:21:03 -0700
committerEric Wong <normalperson@yhbt.net>2010-10-22 16:21:03 -0700
commit180485d49ea858f83ef2a28a9e07224aa514edc7 (patch)
treeb4c649d2118c0010bf3876a49dadfe3e4cbc3f86 /lib/rainbows/rev_fiber_spawn.rb
parent41145ed4d335718ac43aec9313b7571a12fe96ee (diff)
downloadrainbows-180485d49ea858f83ef2a28a9e07224aa514edc7.tar.gz
This simplifies and disambiguates most constant resolution
issues as well as lowering our identation level.  Hopefully
this makes code easier to understand.
Diffstat (limited to 'lib/rainbows/rev_fiber_spawn.rb')
-rw-r--r--lib/rainbows/rev_fiber_spawn.rb45
1 files changed, 21 insertions, 24 deletions
diff --git a/lib/rainbows/rev_fiber_spawn.rb b/lib/rainbows/rev_fiber_spawn.rb
index 522ae71..39483b3 100644
--- a/lib/rainbows/rev_fiber_spawn.rb
+++ b/lib/rainbows/rev_fiber_spawn.rb
@@ -1,31 +1,28 @@
 # -*- encoding: binary -*-
 require 'rainbows/fiber/rev'
 
-module Rainbows
+# A combination of the Rev and FiberSpawn models.  This allows Ruby
+# 1.9 Fiber-based concurrency for application processing while
+# exposing a synchronous execution model and using scalable network
+# concurrency provided by Rev.  A "rack.input" is exposed as well
+# being Sunshowers-compatible.  Applications are strongly advised to
+# wrap all slow IO objects (sockets, pipes) using the
+# Rainbows::Fiber::IO or a Rev-compatible class whenever possible.
+module Rainbows::RevFiberSpawn
 
-  # A combination of the Rev and FiberSpawn models.  This allows Ruby
-  # 1.9 Fiber-based concurrency for application processing while
-  # exposing a synchronous execution model and using scalable network
-  # concurrency provided by Rev.  A "rack.input" is exposed as well
-  # being Sunshowers-compatible.  Applications are strongly advised to
-  # wrap all slow IO objects (sockets, pipes) using the
-  # Rainbows::Fiber::IO or a Rev-compatible class whenever possible.
-  module RevFiberSpawn
+  include Rainbows::Base
+  include Rainbows::Fiber::Rev
 
-    include Base
-    include Fiber::Rev
-
-    def worker_loop(worker) # :nodoc:
-      Rainbows::Response.setup(Rainbows::Fiber::Rev::Server)
-      init_worker_process(worker)
-      Server.const_set(:MAX, @worker_connections)
-      Rainbows::Fiber::Base.setup(Rainbows::Fiber::Rev::Server, nil)
-      Server.const_set(:APP, G.server.app)
-      Heartbeat.new(1, true).attach(::Rev::Loop.default)
-      kato = Kato.new.attach(::Rev::Loop.default)
-      Rainbows::Fiber::Rev::Methods.const_set(:KATO, kato)
-      LISTENERS.map! { |s| Server.new(s).attach(::Rev::Loop.default) }
-      ::Rev::Loop.default.run
-    end
+  def worker_loop(worker) # :nodoc:
+    Rainbows::Response.setup(Server)
+    init_worker_process(worker)
+    Server.const_set(:MAX, @worker_connections)
+    Rainbows::Fiber::Base.setup(Server, nil)
+    Server.const_set(:APP, G.server.app)
+    Heartbeat.new(1, true).attach(Rev::Loop.default)
+    kato = Kato.new.attach(Rev::Loop.default)
+    Rainbows::Fiber::Rev::Methods.const_set(:KATO, kato)
+    LISTENERS.map! { |s| Server.new(s).attach(Rev::Loop.default) }
+    Rev::Loop.default.run
   end
 end