Class: TestFtpd::ServerBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/testftpd/server_builder.rb

Constant Summary collapse

DEFAULT_PORT_RANGE =
(21212..21232).to_a

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(config, ports) ⇒ Object



9
10
11
# File 'lib/testftpd/server_builder.rb', line 9

def self.build(config, ports)
  new.build(config, ports)
end

Instance Method Details

#build(config, ports = DEFAULT_PORT_RANGE) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/testftpd/server_builder.rb', line 13

def build(config, ports = DEFAULT_PORT_RANGE)
  @server = nil
  ports.each do |port|
    attempt_to_build config.merge(port: port)
    break if @server
  end
  @server
end