Class: PirateGame::Animation
- Inherits:
-
Shoes::Animation
- Object
- Shoes::Animation
- PirateGame::Animation
- Defined in:
- lib/pirate_game/animation.rb
Overview
An animation that resets the client application if a DRb::DRbConnError is raised during animation.
Instance Method Summary collapse
-
#initialize(app, opts, blk) ⇒ Animation
constructor
See Shoes::Animation for details.
-
#wrap_block(block) ⇒ Object
Wraps
block
in an exception handler that switches to the select_game_screen.
Constructor Details
permalink #initialize(app, opts, blk) ⇒ Animation
See Shoes::Animation for details
12 13 14 15 16 |
# File 'lib/pirate_game/animation.rb', line 12 def initialize app, opts, blk blk = wrap_block blk super app, opts, blk end |
Instance Method Details
permalink #wrap_block(block) ⇒ Object
Wraps block
in an exception handler that switches to the select_game_screen.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pirate_game/animation.rb', line 22 def wrap_block block # :nodoc: proc do |*args| begin block.call(*args) rescue DRb::DRbConnError @app.state = :select_game @app.select_game_screen end end end |