Class: ProconBypassMan::SafeTimeout
- Inherits:
-
Object
- Object
- ProconBypassMan::SafeTimeout
- Defined in:
- lib/procon_bypass_man/support/safe_timeout.rb
Defined Under Namespace
Classes: Timeout
Instance Method Summary collapse
-
#initialize(timeout: Time.now + 5) ⇒ SafeTimeout
constructor
5秒後がタイムアウト.
- #throw_if_timeout! ⇒ Object
- #timeout? ⇒ Boolean
Constructor Details
#initialize(timeout: Time.now + 5) ⇒ SafeTimeout
5秒後がタイムアウト
6 7 8 |
# File 'lib/procon_bypass_man/support/safe_timeout.rb', line 6 def initialize(timeout: Time.now + 5) @timeout = timeout end |
Instance Method Details
#throw_if_timeout! ⇒ Object
11 12 13 |
# File 'lib/procon_bypass_man/support/safe_timeout.rb', line 11 def throw_if_timeout! raise Timeout if timeout? end |
#timeout? ⇒ Boolean
16 17 18 |
# File 'lib/procon_bypass_man/support/safe_timeout.rb', line 16 def timeout? @timeout < Time.now end |