Class: Gameworks::Fuse
- Inherits:
-
Object
- Object
- Gameworks::Fuse
- Defined in:
- lib/gameworks/fuse.rb
Instance Method Summary collapse
- #abort ⇒ Object
-
#initialize(seconds) ⇒ Fuse
constructor
A new instance of Fuse.
Constructor Details
#initialize(seconds) ⇒ Fuse
Returns a new instance of Fuse.
5 6 7 8 9 10 |
# File 'lib/gameworks/fuse.rb', line 5 def initialize(seconds) @aborted = false EventMachine::add_timer(seconds) do yield unless @aborted end end |
Instance Method Details
#abort ⇒ Object
12 13 14 |
# File 'lib/gameworks/fuse.rb', line 12 def abort @aborted = true end |