light_stopwatch 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/light_stopwatch.rb +6 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6af65a9ba5b43318a9e2643dcdd3a969af6c0a42
|
4
|
+
data.tar.gz: f0ede6b50b91df6e340b48e1e50d8a7cfa4da495
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a6bf8767d3f950314d770a93cd01e50b0ca1c5810de24f367b56e7dc1c10c10e24f6c3c81c3917049edb268eeaa7f71a2a47302025cde1751ea583247061636
|
7
|
+
data.tar.gz: ee8769494c1245b268c0546f0c4e7a31c9522ca3eff173dcbc5ec6245196d7c3152bf7ddddc60648469ff3658a41d8fee5a29f15ebeb79fe19aa9d18479a404d
|
data/lib/light_stopwatch.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module LightStopwatch
|
2
|
+
DEFAULT_TAG = 'Operation took:'
|
3
|
+
|
2
4
|
def get_time(&block)
|
3
5
|
LightStopwatch.get_time(&block)
|
4
6
|
end
|
5
7
|
|
6
|
-
def measure(&block)
|
7
|
-
LightStopwatch.measure(&block)
|
8
|
+
def measure(tag = DEFAULT_TAG, &block)
|
9
|
+
LightStopwatch.measure(tag, &block)
|
8
10
|
end
|
9
11
|
|
10
12
|
def self.get_time(&block)
|
@@ -15,8 +17,8 @@ module LightStopwatch
|
|
15
17
|
stop - start
|
16
18
|
end
|
17
19
|
|
18
|
-
def self.measure(&block)
|
19
|
-
puts "
|
20
|
+
def self.measure(tag = DEFAULT_TAG, &block)
|
21
|
+
puts "#{tag} #{get_time(&block)}"
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: light_stopwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Renra Gloser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: '["Measure the execute time of anything that you pass in a block"]'
|
14
14
|
email:
|
15
15
|
- jan.renra.gloser@gmail.com
|
16
16
|
executables: []
|