module Timeoutable

Constants

LOGGER
MAJOR
MINOR
PATCH
PROC
VERSION

Public Class Methods

get_version() click to toggle source
# File lib/timeoutable/version.rb, line 9
def self.get_version
  puts VERSION
end
timeout(warn:, timeout:, proc: ->(_, _) {} click to toggle source
# File lib/timeoutable.rb, line 60
def self.timeout(warn:, timeout:, proc: ->(_, _) {}, exception: TimeoutExceeded, message: nil, debug: false, &block)
  raise ArgumentError, 'Block not given' unless block_given?

  LOGGER.info "at: timeout; valid bock given" if debug
  message ||= "Execution exceeded #{timeout} seconds."
  PROC.call(warn, timeout, proc, exception, message, debug, &block)
end