Sha256: e98bdf39b3f2e3c326833e03f26602f12ff11c2225f647c686d06489ad042b03

Contents?: true

Size: 369 Bytes

Versions: 20

Compression:

Stored size: 369 Bytes

Contents

module ProconBypassMan
  class SafeTimeout
    class Timeout < StandardError; end

    # 5秒後がタイムアウト
    def initialize(timeout: Time.now + 5)
      @timeout = timeout
    end

    # @raise [Timeout]
    def throw_if_timeout!
      raise Timeout if timeout?
    end

    # @return [Boolean]
    def timeout?
      @timeout < Time.now
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.2.2 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.2.1 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.2.0 lib/procon_bypass_man/support/safe_timeout.rb
procon_bypass_man-0.1.23 lib/procon_bypass_man/support/safe_timeout.rb