Module: EvilSystems::RemoteChrome
- Defined in:
- lib/evil_systems/remote_chrome.rb
Class Method Summary collapse
-
.connected? ⇒ Boolean
Whether or not the socket could be connected.
-
.host ⇒ String?
Current host.
-
.options ⇒ Hash{:url => String, nil}
Returns a hash with a :url key / value if a remote chrome url is found.
-
.port ⇒ Object
Current port.
- .url ⇒ String?
Class Method Details
.connected? ⇒ Boolean
Whether or not the socket could be connected
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/evil_systems/remote_chrome.rb', line 31 def self.connected? if url.nil? false else Socket.tcp(host, port, connect_timeout: 1).close true end rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError false end |
.host ⇒ String?
Current host
16 17 18 |
# File 'lib/evil_systems/remote_chrome.rb', line 16 def self.host URI.parse(url).yield_self { |uri| uri.host } if url end |
.options ⇒ Hash{:url => String, nil}
Returns a hash with a :url key / value if a remote chrome url is found.
23 24 25 26 27 |
# File 'lib/evil_systems/remote_chrome.rb', line 23 def self. # Check whether the remote chrome is running and configure the Capybara # driver for it. connected? ? {url: url} : {} end |
.port ⇒ Object
Current port
10 11 12 |
# File 'lib/evil_systems/remote_chrome.rb', line 10 def self.port URI.parse(url).yield_self { |uri| uri.port } end |
.url ⇒ String?
4 5 6 |
# File 'lib/evil_systems/remote_chrome.rb', line 4 def self.url ENV["CHROME_URL"] end |