Class: ActiveSupport::Testing::Parallelization
- Defined in:
 - lib/active_support/testing/parallelization.rb,
lib/active_support/testing/parallelization/server.rb,
lib/active_support/testing/parallelization/worker.rb 
Overview
:nodoc:
Defined Under Namespace
Constant Summary collapse
- @@after_fork_hooks =
 []
- @@run_cleanup_hooks =
 []
Class Method Summary collapse
Instance Method Summary collapse
- #<<(work) ⇒ Object
 - 
  
    
      #initialize(worker_count)  ⇒ Parallelization 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Parallelization.
 - #shutdown ⇒ Object
 - #size ⇒ Object
 - #start ⇒ Object
 
Constructor Details
#initialize(worker_count) ⇒ Parallelization
Returns a new instance of Parallelization.
      28 29 30 31 32 33  | 
    
      # File 'lib/active_support/testing/parallelization.rb', line 28 def initialize(worker_count) @worker_count = worker_count @queue_server = Server.new @worker_pool = [] @url = DRb.start_service("drbunix:", @queue_server).uri end  | 
  
Class Method Details
.after_fork_hook(&blk) ⇒ Object
      14 15 16  | 
    
      # File 'lib/active_support/testing/parallelization.rb', line 14 def self.after_fork_hook(&blk) @@after_fork_hooks << blk end  | 
  
.run_cleanup_hook(&blk) ⇒ Object
      22 23 24  | 
    
      # File 'lib/active_support/testing/parallelization.rb', line 22 def self.run_cleanup_hook(&blk) @@run_cleanup_hooks << blk end  | 
  
Instance Method Details
#<<(work) ⇒ Object
      41 42 43  | 
    
      # File 'lib/active_support/testing/parallelization.rb', line 41 def <<(work) @queue_server << work end  | 
  
#shutdown ⇒ Object
      49 50 51 52  | 
    
      # File 'lib/active_support/testing/parallelization.rb', line 49 def shutdown @queue_server.shutdown @worker_pool.each { |pid| Process.waitpid pid } end  | 
  
#size ⇒ Object
      45 46 47  | 
    
      # File 'lib/active_support/testing/parallelization.rb', line 45 def size @worker_count end  |