mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
19 lines
246 B
Ruby
19 lines
246 B
Ruby
![]() |
# typed: false
|
||
|
# frozen_string_literal: true
|
||
|
|
||
|
module TimeRemaining
|
||
|
refine Time do
|
||
|
def remaining
|
||
|
[0, self - Time.now].max
|
||
|
end
|
||
|
|
||
|
def remaining!
|
||
|
r = remaining
|
||
|
|
||
|
raise Timeout::Error if r <= 0
|
||
|
|
||
|
r
|
||
|
end
|
||
|
end
|
||
|
end
|