timeouter 0.1.2.16523 → 0.1.2.38793
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/lib/timeouter/timer.rb +2 -2
- 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: 597aa59fbdb2bb4df72bb4883bba84c02a31217a02fb843954ecd9c1cbd11e88
|
4
|
+
data.tar.gz: e350922ccb84f700c221e8bf1feb4b754712b45fcfa70ca5f8c94188bb9207e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bde0d8539b2a44882f630eebaf6268480b920dbe61c3c5c7db015c6a96a7926b2561fe0bba769f0ae8cc326aecd3306b4ada335ddae3db3ad8a91f9cd4372e7
|
7
|
+
data.tar.gz: 8c13f71c579346723a8adc67e08f6acef330d0dc948109d05cf1fe469641a4460f7fb160178e08285963beeb336f657aa72731a7cda546a141d1c06c9f5e4c3f
|
data/README.md
CHANGED
@@ -2,11 +2,13 @@
|
|
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
|
-
[![
|
6
|
-
|
7
|
-
[![
|
8
|
-
[![
|
9
|
-
[![
|
5
|
+
[![YARD](https://badgen.net/badge/YARD/doc/blue)](http://www.rubydoc.info/gems/timeouter)
|
6
|
+
|
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
|
+
|
10
12
|
|
11
13
|
Timeouter is advisory timeout helper without any background threads.
|
12
14
|
|
@@ -21,7 +23,7 @@ Timeouter::run(3) do |t|
|
|
21
23
|
sleep 1 # do some work
|
22
24
|
|
23
25
|
puts t.elapsed # 1.00011811
|
24
|
-
puts t.left #
|
26
|
+
puts t.left # 1.99985717 or nil if timeout was 0
|
25
27
|
puts t.exhausted? # false or nil if timeout was 0
|
26
28
|
puts t.running? # true
|
27
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
|
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.2.
|
4
|
+
version: 0.1.2.38793
|
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
|