elapsed 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ab0d9b705b74c441eef63687e672e69b510fc5cbfa7bb4991a750f8ad425c41
4
- data.tar.gz: a259442225df1d9e5fcca5fab34454c7f671fd6c4e87c4636f715e904c13bb5a
3
+ metadata.gz: d886bd2790851f3b951a3a8c011a27b4bd0b0c5f796a49c3ecbbbfaa5e72a729
4
+ data.tar.gz: acd115ed0fb01bd5ce9b85063df24e138d9102ccb2e0fa2050f6ecf92a08d1fa
5
5
  SHA512:
6
- metadata.gz: 7ab0513faf244c4f4c88f0529dfcb79d7909e9a33c37345e18fa1413c4e62be24a13ace917f21a2b7eb31acd7543f1031c1fff52c5ddff3e968e1828dbd362f9
7
- data.tar.gz: 856f0965f4c08301e0e42d2eacb165d4eb19b4c5c8b8672435c82813ceb3301e72575a1d40ddbf74defe3af2502835a61736c34e3b1729b89b0d017e9944a96e
6
+ metadata.gz: 880f408e50c3225dc38d84fd0a3d0e162538dcb67b362bb5c8dfe4ea1d1c2bcc0f2c1085a7d1749e79bd3be6138e08e9c3c0ee52996288bf7197def4ed187385
7
+ data.tar.gz: 15a9f179ef1a1bc36757e7a3cf6a1a3f818f2491c179ab25b52065a93ee13c0fb59686c9f926cd9582059ed386f8221f9ee871bd539a71da282c498686abd56f
data/Gemfile.lock CHANGED
@@ -13,12 +13,14 @@ GEM
13
13
  builder (3.3.0)
14
14
  date (3.5.1)
15
15
  docile (1.4.1)
16
+ ellipsized (0.3.0)
16
17
  erb (6.0.1)
17
18
  json (2.18.0)
18
19
  language_server-protocol (3.17.0.5)
19
20
  lint_roller (1.1.0)
20
21
  logger (1.7.0)
21
- loog (0.6.1)
22
+ loog (0.7.2)
23
+ ellipsized
22
24
  logger (~> 1.0)
23
25
  minitest (6.0.1)
24
26
  prism (~> 1.5)
@@ -28,23 +30,23 @@ GEM
28
30
  minitest (>= 5.0)
29
31
  ruby-progressbar
30
32
  parallel (1.27.0)
31
- parser (3.3.10.0)
33
+ parser (3.3.10.1)
32
34
  ast (~> 2.4.1)
33
35
  racc
34
- prism (1.6.0)
36
+ prism (1.9.0)
35
37
  psych (5.3.1)
36
38
  date
37
39
  stringio
38
40
  racc (1.8.1)
39
41
  rainbow (3.1.1)
40
42
  rake (13.3.1)
41
- rdoc (7.0.3)
43
+ rdoc (7.1.0)
42
44
  erb
43
45
  psych (>= 4.0.0)
44
46
  tsort
45
47
  regexp_parser (2.11.3)
46
48
  rexml (3.4.4)
47
- rubocop (1.82.1)
49
+ rubocop (1.84.1)
48
50
  json (~> 2.3)
49
51
  language_server-protocol (~> 3.17.0.2)
50
52
  lint_roller (~> 1.1.0)
@@ -52,12 +54,12 @@ GEM
52
54
  parser (>= 3.3.0.2)
53
55
  rainbow (>= 2.2.2, < 4.0)
54
56
  regexp_parser (>= 2.9.3, < 3.0)
55
- rubocop-ast (>= 1.48.0, < 2.0)
57
+ rubocop-ast (>= 1.49.0, < 2.0)
56
58
  ruby-progressbar (~> 1.7)
57
59
  unicode-display_width (>= 2.4.0, < 4.0)
58
- rubocop-ast (1.48.0)
60
+ rubocop-ast (1.49.0)
59
61
  parser (>= 3.3.7.2)
60
- prism (~> 1.4)
62
+ prism (~> 1.7)
61
63
  rubocop-minitest (0.38.2)
62
64
  lint_roller (~> 1.1)
63
65
  rubocop (>= 1.75.0, < 2.0)
@@ -80,7 +82,7 @@ GEM
80
82
  simplecov-html (0.13.2)
81
83
  simplecov_json_formatter (0.1.4)
82
84
  stringio (3.2.0)
83
- tago (0.6.0)
85
+ tago (0.7.0)
84
86
  tsort (0.2.0)
85
87
  unicode-display_width (3.2.0)
86
88
  unicode-emoji (~> 4.1)
data/elapsed.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
10
  s.required_ruby_version = '>=3.2'
11
11
  s.name = 'elapsed'
12
- s.version = '0.2.2'
12
+ s.version = '0.3.1'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'A simple Ruby function to measure the time elapsed by the execution of a block'
15
15
  s.description =
data/lib/elapsed.rb CHANGED
@@ -24,7 +24,7 @@ require 'tago'
24
24
  # @param [String] bad The message to print on failure finish
25
25
  # @param [Integer] level The level of logging to use
26
26
  # @param [Float] over The minimum duration in seconds to report
27
- def elapsed(log = nil, good: 'Finished', level: Logger::DEBUG, bad: 'Failed', over: 0)
27
+ def elapsed(log = nil, good: 'Finished', level: Logger::DEBUG, bad: nil, over: 0)
28
28
  start = Time.now
29
29
  print_it = lambda do |m|
30
30
  duration = Time.now - start
@@ -58,7 +58,7 @@ def elapsed(log = nil, good: 'Finished', level: Logger::DEBUG, bad: 'Failed', ov
58
58
  print_it.call(tag.to_s)
59
59
  rescue StandardError => e
60
60
  done = true
61
- print_it.call(bad.to_s)
61
+ print_it.call((bad || "#{e.message} (#{e.class.name})").to_s)
62
62
  raise e
63
63
  ensure
64
64
  print_it.call(good.to_s) unless done
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elapsed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko