Class: EmmyHttp::Timeout
- Inherits:
-
Object
- Object
- EmmyHttp::Timeout
- Defined in:
- lib/emmy_http/timeout.rb
Instance Attribute Summary collapse
-
#interval ⇒ Object
Returns the value of attribute interval.
Instance Method Summary collapse
-
#initialize(interval) ⇒ Timeout
constructor
A new instance of Timeout.
- #start ⇒ Object
- #sync ⇒ Object
Constructor Details
#initialize(interval) ⇒ Timeout
Returns a new instance of Timeout.
8 9 10 |
# File 'lib/emmy_http/timeout.rb', line 8 def initialize(interval) @interval = interval end |
Instance Attribute Details
#interval ⇒ Object
Returns the value of attribute interval.
4 5 6 |
# File 'lib/emmy_http/timeout.rb', line 4 def interval @interval end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 |
# File 'lib/emmy_http/timeout.rb', line 12 def start EmmyMachine.timeout(interval) do timeout! end end |
#sync ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/emmy_http/timeout.rb', line 18 def sync Fiber.sync do |fiber| # create connection start on :timeout do fiber.resume true end end end |