about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-26 21:46:46 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-26 21:47:28 +0000
commit6741aa27e4c35724b5306644d3a391fce415b0c7 (patch)
treee2a904a3a1dc2b3ee4f4a4063e36642a35e1b636
parent869e0d5da8cbe8959983ed66e2b4c31dc7a37d92 (diff)
downloadrainbows-6741aa27e4c35724b5306644d3a391fce415b0c7.tar.gz
One line of code saved!  We'll also avoid loading
DeferredChunkResponse which is rarely needed
(unlike DeferredResponse).
-rw-r--r--lib/rainbows.rb1
-rw-r--r--lib/rainbows/event_machine.rb1
-rw-r--r--lib/rainbows/rev.rb9
-rw-r--r--lib/rainbows/rev/client.rb1
-rw-r--r--lib/rainbows/rev/core.rb4
-rw-r--r--lib/rainbows/rev/master.rb3
-rw-r--r--lib/rainbows/rev/thread_client.rb2
7 files changed, 10 insertions, 11 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index 144b539..e9f2448 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -46,6 +46,7 @@ module Rainbows
   autoload :DevFdResponse, 'rainbows/dev_fd_response'
   autoload :MaxBody, 'rainbows/max_body'
   autoload :QueuePool, 'rainbows/queue_pool'
+  autoload :EvCore, 'rainbows/ev_core'
 
   class << self
 
diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb
index 8029b1a..a307f4c 100644
--- a/lib/rainbows/event_machine.rb
+++ b/lib/rainbows/event_machine.rb
@@ -1,7 +1,6 @@
 # -*- encoding: binary -*-
 require 'eventmachine'
 EM::VERSION >= '0.12.10' or abort 'eventmachine 0.12.10 is required'
-require 'rainbows/ev_core'
 
 # Implements a basic single-threaded event model with
 # {EventMachine}[http://rubyeventmachine.com/].  It is capable of
diff --git a/lib/rainbows/rev.rb b/lib/rainbows/rev.rb
index fd39cf3..6ddb130 100644
--- a/lib/rainbows/rev.rb
+++ b/lib/rainbows/rev.rb
@@ -1,4 +1,6 @@
 # -*- encoding: binary -*-
+require 'rev'
+Rev::VERSION >= '0.3.0' or abort 'rev >= 0.3.0 is required'
 
 # Implements a basic single-threaded event model with
 # {Rev}[http://rev.rubyforge.org/].  It is capable of handling
@@ -30,11 +32,16 @@ module Rainbows::Rev
     CONN.compare_by_identity
     KATO.compare_by_identity
   end
+
+  autoload :Master, 'rainbows/rev/master'
+  autoload :ThreadClient, 'rainbows/rev/thread_client'
+  autoload :DeferredChunkResponse, 'rainbows/rev/deferred_chunk_response'
   # :startdoc:
 end
 # :enddoc:
+require 'rainbows/rev/heartbeat'
+require 'rainbows/rev/server'
 require 'rainbows/rev/core'
 require 'rainbows/rev/deferred_response'
-require 'rainbows/rev/deferred_chunk_response'
 require 'rainbows/rev/client'
 Rainbows::Rev.__send__ :include, Rainbows::Rev::Core
diff --git a/lib/rainbows/rev/client.rb b/lib/rainbows/rev/client.rb
index 8c39792..f35ef68 100644
--- a/lib/rainbows/rev/client.rb
+++ b/lib/rainbows/rev/client.rb
@@ -1,6 +1,5 @@
 # -*- encoding: binary -*-
 # :enddoc:
-require 'rainbows/ev_core'
 class Rainbows::Rev::Client < ::Rev::IO
   include Rainbows::EvCore
   G = Rainbows::G
diff --git a/lib/rainbows/rev/core.rb b/lib/rainbows/rev/core.rb
index c7aeb04..5dc4ebe 100644
--- a/lib/rainbows/rev/core.rb
+++ b/lib/rainbows/rev/core.rb
@@ -1,9 +1,5 @@
 # -*- encoding: binary -*-
 # :enddoc:
-require 'rev'
-Rev::VERSION >= '0.3.0' or abort 'rev >= 0.3.0 is required'
-require 'rainbows/rev/heartbeat'
-require 'rainbows/rev/server'
 module Rainbows::Rev::Core
   include Rainbows::Base
 
diff --git a/lib/rainbows/rev/master.rb b/lib/rainbows/rev/master.rb
index 8e5d4ef..19992c2 100644
--- a/lib/rainbows/rev/master.rb
+++ b/lib/rainbows/rev/master.rb
@@ -1,7 +1,6 @@
 # -*- encoding: binary -*-
 # :enddoc:
-require 'rainbows/rev'
-
+require 'thread'
 class Rainbows::Rev::Master < Rev::IOWatcher
 
   def initialize(queue)
diff --git a/lib/rainbows/rev/thread_client.rb b/lib/rainbows/rev/thread_client.rb
index e529b5b..d6e6655 100644
--- a/lib/rainbows/rev/thread_client.rb
+++ b/lib/rainbows/rev/thread_client.rb
@@ -1,7 +1,5 @@
 # -*- encoding: binary -*-
 # :enddoc:
-require 'thread'
-require 'rainbows/rev/master'
 
 RUBY_VERSION =~ %r{\A1\.8} and
   warn "Rev and Threads do not mix well under Ruby 1.8"