Method: RandomPort::Pool#initialize

Defined in:
lib/random-port/pool.rb

#initialize(sync: true, limit: 65_536, start: 1025) ⇒ Pool

Constructor.

Parameters:

  • sync (Boolean) (defaults to: true)

    Set to FALSE if you want this pool to be non-thread-safe

  • limit (Integer) (defaults to: 65_536)

    The maximum number of ports that can be acquired from the pool

  • start (Integer) (defaults to: 1025)

    The first port number to try when acquiring



41
42
43
44
45
46
47
# File 'lib/random-port/pool.rb', line 41

def initialize(sync: true, limit: 65_536, start: 1025)
  @ports = []
  @sync = sync
  @monitor = Monitor.new
  @limit = limit
  @next = start
end