Class: Replicant::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/replicant/server.rb

Class Method Summary collapse

Class Method Details

.start(mock, port = 9000) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/replicant/server.rb', line 3

def self.start( mock, port = 9000 )
  @server, @port = nil, port

  @thread = Thread.new do
    Rack::Handler::Thin.run( mock, :Port => @port ) do |server|
      @server = server
    end
  end
  
  Thread.pass until @server && @server.running?
end

.stopObject



15
16
17
18
# File 'lib/replicant/server.rb', line 15

def self.stop
  @server.stop!
  @thread.terminate
end