Sha256: 4435e42e40fa2572b6083dc7514a96f58323c0b01e2b7b9f7c6aeadacb520d1e

Contents?: true

Size: 488 Bytes

Versions: 7

Compression:

Stored size: 488 Bytes

Contents

module Evrone
  module Common
    module Spawn
      class ReadTimeout

        def initialize(val)
          @value    = val.to_f > 0 ? val.to_f : nil
          @happened = false
        end

        def reset
          @tm = Time.new if @value
        end

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

          @happened = Time.now > (@tm + @value)
        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/read_timeout.rb
evrone-common-spawn-0.0.6 lib/evrone/common/spawn/read_timeout.rb
evrone-common-spawn-0.0.5 lib/evrone/common/spawn/read_timeout.rb
evrone-common-spawn-0.0.4 lib/evrone/common/spawn/read_timeout.rb
evrone-common-spawn-0.0.3 lib/evrone/common/spawn/read_timeout.rb
evrone-common-spawn-0.0.2 lib/evrone/common/spawn/read_timeout.rb
evrone-common-spawn-0.0.1 lib/evrone/common/spawn/read_timeout.rb