Sha256: 820bb993c38e3a021d16a7e7f4b753f482fa357c25e310bf59d9ef3169cd507e

Contents?: true

Size: 494 Bytes

Versions: 7

Compression:

Stored size: 494 Bytes

Contents

module Evrone
  module Common
    module Spawn
      class Timeout
        def initialize(value)
          @value = (value.to_f > 0) ? value.to_f : nil
          if @value
            @time_end = Time.now + @value
          end
          @happened = false
        end

        def happened?
          return false unless value
          return true if @happened

          @happened = Time.now > @time_end
        end

        def value
          @value
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
evrone-common-spawn-0.0.7 lib/evrone/common/spawn/timeout.rb
evrone-common-spawn-0.0.6 lib/evrone/common/spawn/timeout.rb
evrone-common-spawn-0.0.5 lib/evrone/common/spawn/timeout.rb
evrone-common-spawn-0.0.4 lib/evrone/common/spawn/timeout.rb
evrone-common-spawn-0.0.3 lib/evrone/common/spawn/timeout.rb
evrone-common-spawn-0.0.2 lib/evrone/common/spawn/timeout.rb
evrone-common-spawn-0.0.1 lib/evrone/common/spawn/timeout.rb