class Hyperion::ServerPool
Public Class Methods
new()
click to toggle source
# File lib/hyperion_test/server_pool.rb, line 3 def initialize @free = [] @in_use = [] end
Public Instance Methods
check_in(s)
click to toggle source
# File lib/hyperion_test/server_pool.rb, line 14 def check_in(s) @in_use.delete(s) @free.push(s) end
check_out()
click to toggle source
# File lib/hyperion_test/server_pool.rb, line 8 def check_out s = @free.pop || FakeServer.new(next_port) @in_use.push(s) s end
clear()
click to toggle source
# File lib/hyperion_test/server_pool.rb, line 19 def clear all = @free + @in_use all.each(&:teardown) @free = [] @in_use = [] end
Private Instance Methods
next_port()
click to toggle source
# File lib/hyperion_test/server_pool.rb, line 28 def next_port @last_port ||= 9000 @last_port += 1 end