Sha256: 1f2f17b4d4e534648bf2c514cd2dfcfcde5624b165eaa3b91cd62454c5ba33d4

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

require 'shoes'

##
# An animation that resets the client application if a DRb::DRbConnError is
# raised during animation.

class PirateGame::Animation < Shoes::Animation

  ##
  # See Shoes::Animation for details

  def initialize app, opts, blk
    blk = wrap_block blk

    super app, opts, blk
  end

  ##
  # Wraps +block+ in an exception handler that switches to the
  # select_game_screen.

  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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pirate_game-0.0.1 lib/pirate_game/animation.rb