Class: Invoker::Power::PortFinder
- Inherits:
-
Object
- Object
- Invoker::Power::PortFinder
- Defined in:
- lib/invoker/power/port_finder.rb
Constant Summary collapse
- STARTING_PORT =
23400
Instance Attribute Summary collapse
-
#dns_port ⇒ Object
Returns the value of attribute dns_port.
-
#http_port ⇒ Object
Returns the value of attribute http_port.
-
#https_port ⇒ Object
Returns the value of attribute https_port.
-
#starting_port ⇒ Object
Returns the value of attribute starting_port.
Instance Method Summary collapse
- #find_ports ⇒ Object
-
#initialize ⇒ PortFinder
constructor
A new instance of PortFinder.
Constructor Details
#initialize ⇒ PortFinder
Returns a new instance of PortFinder.
6 7 8 9 10 11 |
# File 'lib/invoker/power/port_finder.rb', line 6 def initialize @starting_port = STARTING_PORT @ports = [] @dns_port = nil @http_port = nil end |
Instance Attribute Details
#dns_port ⇒ Object
Returns the value of attribute dns_port.
5 6 7 |
# File 'lib/invoker/power/port_finder.rb', line 5 def dns_port @dns_port end |
#http_port ⇒ Object
Returns the value of attribute http_port.
5 6 7 |
# File 'lib/invoker/power/port_finder.rb', line 5 def http_port @http_port end |
#https_port ⇒ Object
Returns the value of attribute https_port.
5 6 7 |
# File 'lib/invoker/power/port_finder.rb', line 5 def https_port @https_port end |
#starting_port ⇒ Object
Returns the value of attribute starting_port.
5 6 7 |
# File 'lib/invoker/power/port_finder.rb', line 5 def starting_port @starting_port end |
Instance Method Details
#find_ports ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/invoker/power/port_finder.rb', line 13 def find_ports STARTING_PORT.upto(STARTING_PORT + 100) do |port| break if @ports.size > 3 if check_if_port_is_open(port) @ports << port else next end end @dns_port = @ports[0] @http_port = @ports[1] @https_port = @ports[2] end |