Module: Utils::Timer Private

Defined in:
utils/timer.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Class Method Summary collapse

Class Method Details

.remaining(time) ⇒ Float, ...

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:

  • (Float, Integer, nil)


7
8
9
10
11
# File 'utils/timer.rb', line 7

def self.remaining(time)
  return unless time

  [0, time - Time.now].max
end

.remaining!(time) ⇒ Float, ...

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:

  • (Float, Integer, nil)

Raises:

  • (Timeout::Error)


14
15
16
17
18
19
# File 'utils/timer.rb', line 14

def self.remaining!(time)
  r = remaining(time)
  raise Timeout::Error if r && r <= 0

  r
end