Sha256: 0941fca49ac6137c039f7c8992f2c65a72500011106aab12efecd6c017922452

Contents?: true

Size: 437 Bytes

Versions: 1

Compression:

Stored size: 437 Bytes

Contents

##
# A renewer that expires when its timeout is up

class PirateGame::TimeoutRenewer

  include DRbUndumped

  ##
  # The timeout for the renewer (after first renewal)

  attr_reader :timeout

  ##
  # Creates a renewer that will expire after the +timeout+ passes.

  def initialize timeout
    @timeout = timeout
    @renew = true
  end

  def renew # :nodoc:
    return true unless @renew

    @renew = false

    @timeout
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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