Class: PlaywrightOnRails::Server::Checker
- Inherits:
-
Object
- Object
- PlaywrightOnRails::Server::Checker
- Defined in:
- lib/playwright-on-rails/server/checker.rb
Constant Summary collapse
- TRY_HTTPS_ERRORS =
[EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze
Instance Method Summary collapse
-
#initialize(host, port) ⇒ Checker
constructor
A new instance of Checker.
- #request(&block) ⇒ Object
- #ssl? ⇒ Boolean
Constructor Details
#initialize(host, port) ⇒ Checker
Returns a new instance of Checker.
6 7 8 9 |
# File 'lib/playwright-on-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/playwright-on-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
19 20 21 |
# File 'lib/playwright-on-rails/server/checker.rb', line 19 def ssl? @ssl end |