class Loupe::QueueServer
Server
This object is the one passed to DRb in order to communicate between worker and server processes and coordinate both the queue and the reporting results
Public Class Methods
new(queue, reporter)
click to toggle source
The two operations we need to synchronize between the main process and its children is the queue and the reporter. We need to share the queue, so that workers can pop the tests from it and we need to share the reporter, so that workers can update the results
@param queue [Array<Array<Class, Symbol>>] @param reporter [Loupe::Reporter] @return [Loupe::Server]
# File lib/loupe/queue_server.rb, line 18 def initialize(queue, reporter) @queue = queue @reporter = reporter end
Public Instance Methods
add_reporter(other)
click to toggle source
Adds a temporary reporter from a child process into the main reporter to aggregate results
@param other [Loupe::Reporter] @return [void]
# File lib/loupe/queue_server.rb, line 30 def add_reporter(other) @reporter << other end
empty?()
click to toggle source
@return [Boolean]
# File lib/loupe/queue_server.rb, line 45 def empty? @queue.empty? end
length()
click to toggle source
@return [Integer]
# File lib/loupe/queue_server.rb, line 40 def length @queue.length end
pop()
click to toggle source
@return [Array<Class, Symbol>]
# File lib/loupe/queue_server.rb, line 35 def pop @queue.pop end