Sha256: 66f0353c982e36638f0e127bad27b523b3210c030b746133dfa3675064eab355
Contents?: true
Size: 387 Bytes
Versions: 14
Compression:
Stored size: 387 Bytes
Contents
require 'timeout' module LightIO::Library module Timeout extend self Error = ::Timeout::Error def timeout(sec, klass=Error, &blk) return yield(sec) if sec.nil? or sec.zero? beam = LightIO::Beam.new(sec, &blk) message = "execution expired" if beam.join(sec).nil? raise klass, message else beam.value end end end end
Version data entries
14 entries across 14 versions & 1 rubygems