Class: Utils::PortExplorer

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/port_explorer.rb

Class Method Summary collapse

Class Method Details

.port_occupied?(port) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'lib/utils/port_explorer.rb', line 5

def self.port_occupied?(port)
  !!Net::HTTP.get('localhost', '/', port)
rescue => e
  !e.is_a?(Errno::ECONNREFUSED)
else
  true
end