Sha256: 3af90fa4f4122fb63cda0041cb634164f8412128b9a18ce8b1aaaa72de318f6c
Contents?: true
Size: 634 Bytes
Versions: 20
Compression:
Stored size: 634 Bytes
Contents
require 'concurrent/maybe' require 'concurrent/utility/monotonic_time' module Concurrent class Channel class Selector class AfterClause def initialize(seconds, block) raise ArgumentError.new('timeout must 0.0 or more') if seconds.to_f < 0.0 @end = Concurrent.monotonic_time + seconds.to_f @block = block end def execute if Concurrent.monotonic_time > @end result = @block ? @block.call : nil Concurrent::Maybe.just(result) else Concurrent::Maybe.nothing end end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems