class Webpack::DevServer::Process
Attributes
timeout[R]
uri[R]
Public Class Methods
new(address, timeout: 0.01)
click to toggle source
# File lib/webpack/dev_server/process.rb, line 12 def initialize(address, timeout: 0.01) uri = URI.parse(address.to_s) case uri when URI::HTTP, URI::HTTPS @uri = uri else raise UnsupportedAddressError, "`#{address}` is unsupported address." end @timeout = timeout end
Public Instance Methods
host()
click to toggle source
# File lib/webpack/dev_server/process.rb, line 32 def host uri.host end
host_with_port()
click to toggle source
# File lib/webpack/dev_server/process.rb, line 40 def host_with_port "#{host}:#{port}" end
https?()
click to toggle source
# File lib/webpack/dev_server/process.rb, line 28 def https? protocol == "https" end
port()
click to toggle source
# File lib/webpack/dev_server/process.rb, line 36 def port uri.port end
protocol()
click to toggle source
# File lib/webpack/dev_server/process.rb, line 24 def protocol uri.scheme end
running?()
click to toggle source
# File lib/webpack/dev_server/process.rb, line 44 def running? Socket.tcp(host, port, connect_timeout: timeout).close true rescue StandardError false end