module ExecutionDeadline
Constants
- VERSION
Public Class Methods
clear_deadline!()
click to toggle source
# File lib/execution_deadline.rb, line 11 def self.clear_deadline! Thread.current[:deadline] = nil end
current_deadline()
click to toggle source
# File lib/execution_deadline.rb, line 7 def self.current_deadline Thread.current[:deadline] end
extended(other)
click to toggle source
# File lib/execution_deadline.rb, line 24 def self.extended(other) other.extend(Helpers) end
included(other)
click to toggle source
# File lib/execution_deadline.rb, line 28 def self.included(other) other.extend(Helpers) end
set_deadline(expires_at:, raises: nil)
click to toggle source
@param expires_at [Time] The time at which to set the current deadline to
expire
@return [Boolean|Deadline] returns false if a deadline is already set, and
returns a deadline object if it was successfully set
# File lib/execution_deadline.rb, line 19 def self.set_deadline(expires_at:, raises: nil) !current_deadline && Thread.current[:deadline] = Deadline.new(expires_at: expires_at, raises: raises) end