timeouter 0.1.2.16535 → 0.1.3.38794
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/timeouter/timer.rb +2 -2
- data/lib/timeouter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2db10bb8d5392fade023253773f456b6462c9f51227c7f92577b14bdd17f0970
|
4
|
+
data.tar.gz: 622f8012de368fc2f9f697b9bdf3ab2ca112d1456e6f7b1c1fcd6a8f59e6d838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fce3ddecbb4f6c3f75eb737e2626417c4e681ff36be6413fbdb26523d6e5f3639336f47b507469dbb4fcc0bcddfd2851acb61b809d907078481ef162f4603fc
|
7
|
+
data.tar.gz: bbbf61f01f2517e3fd3c9b7430da402144b0e736cdaed8cb4789346665b060ff6832a01c15f5aa75102eb1c09f62465f486ef2f46413db71538744c7e75de585
|
data/README.md
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/timeouter.svg)](https://rubygems.org/gems/timeouter)
|
4
4
|
[![Gem](https://img.shields.io/gem/dt/timeouter.svg)](https://rubygems.org/gems/timeouter/versions)
|
5
|
+
[![YARD](https://badgen.net/badge/YARD/doc/blue)](http://www.rubydoc.info/gems/timeouter)
|
5
6
|
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
[![
|
9
|
-
[![
|
10
|
-
[![Vulnerabilities](https://lysander.x.rnds.pro/api/v1/badges/timeouter_vulnerable.svg)](https://lysander.x.rnds.pro/api/v1/badges/timeouter_vulnerable.html)
|
7
|
+
[![Coverage](https://lysander.rnds.pro/api/v1/badges/timeouter_coverage.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_coverage.html)
|
8
|
+
[![Quality](https://lysander.rnds.pro/api/v1/badges/timeouter_quality.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_quality.html)
|
9
|
+
[![Outdated](https://lysander.rnds.pro/api/v1/badges/timeouter_outdated.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_outdated.html)
|
10
|
+
[![Vulnerabilities](https://lysander.rnds.pro/api/v1/badges/timeouter_vulnerable.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_vulnerable.html)
|
11
11
|
|
12
12
|
|
13
13
|
Timeouter is advisory timeout helper without any background threads.
|
@@ -23,7 +23,7 @@ Timeouter::run(3) do |t|
|
|
23
23
|
sleep 1 # do some work
|
24
24
|
|
25
25
|
puts t.elapsed # 1.00011811
|
26
|
-
puts t.left #
|
26
|
+
puts t.left # 1.99985717 or nil if timeout was 0
|
27
27
|
puts t.exhausted? # false or nil if timeout was 0
|
28
28
|
puts t.running? # true
|
29
29
|
puts t.running! # true
|
data/lib/timeouter/timer.rb
CHANGED
@@ -13,12 +13,12 @@ module Timeouter
|
|
13
13
|
@eclass = eclass || Timeouter::TimeoutError
|
14
14
|
@message = message || 'execution expired'
|
15
15
|
|
16
|
-
@started_at =
|
16
|
+
@started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
17
17
|
end
|
18
18
|
|
19
19
|
# elapsed time from creation
|
20
20
|
def elapsed
|
21
|
-
|
21
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC) - @started_at
|
22
22
|
end
|
23
23
|
|
24
24
|
# time left to be exhausted or nil if timeout was 0
|
data/lib/timeouter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeouter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3.38794
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samoilenko Yuri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|