Class: CypressRails::Server::Checker

Inherits:
Object
  • Object
show all
Defined in:
lib/cypress-rails/server/checker.rb

Constant Summary collapse

TRY_HTTPS_ERRORS =
[EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Checker

Returns a new instance of Checker.



6
7
8
9
# File 'lib/cypress-rails/server/checker.rb', line 6

def initialize(host, port)
  @host, @port = host, port
  @ssl = false
end

Instance Method Details

#request(&block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/cypress-rails/server/checker.rb', line 11

def request(&block)
  ssl? ? https_request(&block) : http_request(&block)
rescue *TRY_HTTPS_ERRORS
  res = https_request(&block)
  @ssl = true
  res
end

#ssl?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cypress-rails/server/checker.rb', line 19

def ssl?
  @ssl
end