Class: PirateGame::TimeoutRenewer
- Inherits:
-
Object
- Object
- PirateGame::TimeoutRenewer
- Includes:
- DRbUndumped
- Defined in:
- lib/pirate_game/timeout_renewer.rb
Overview
A renewer that expires when its timeout is up
Instance Attribute Summary collapse
-
#timeout ⇒ Object
readonly
The timeout for the renewer (after first renewal).
Instance Method Summary collapse
-
#initialize(timeout) ⇒ TimeoutRenewer
constructor
Creates a renewer that will expire after the
timeout
passes. -
#renew ⇒ Object
:nodoc:.
Constructor Details
#initialize(timeout) ⇒ TimeoutRenewer
Creates a renewer that will expire after the timeout
passes.
16 17 18 19 |
# File 'lib/pirate_game/timeout_renewer.rb', line 16 def initialize timeout @timeout = timeout @renew = true end |
Instance Attribute Details
#timeout ⇒ Object (readonly)
The timeout for the renewer (after first renewal)
11 12 13 |
# File 'lib/pirate_game/timeout_renewer.rb', line 11 def timeout @timeout end |
Instance Method Details
#renew ⇒ Object
:nodoc:
21 22 23 24 25 26 27 |
# File 'lib/pirate_game/timeout_renewer.rb', line 21 def renew # :nodoc: return true unless @renew @renew = false @timeout end |