step-track 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/step_track.rb +4 -2
- data/lib/step_track/version.rb +1 -1
- data/test/step_track_test.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44d2a673a0a4ad99bef64eb7c0b6938f87a30ede
|
4
|
+
data.tar.gz: 42f58e8beae25271da55980d72e4d1d35fb243dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67becd249f79ffd6e4ccf073190fa6b83a14b2e78b7d256e0fd19f254173629d5a1bc575946c2bbd85d665d664e94b5bca8edf91d4cc2d820e590940effbb833
|
7
|
+
data.tar.gz: b2d198521e9ada64b4a5b5159757b424b60143dcc5cb836b329dcb80b6a56ea63b7f04904573526e3c4f238c9e0a576dcd423417d9361b48689d442dd7f10036
|
data/lib/step_track.rb
CHANGED
@@ -22,7 +22,7 @@ module StepTrack
|
|
22
22
|
split: Time.now - (last_step&.[](:time) || track_ref[:time]),
|
23
23
|
duration: Time.now - track_ref[:time],
|
24
24
|
time: Time.now,
|
25
|
-
caller: caller[0],
|
25
|
+
caller: caller[0].sub(Dir.pwd + "/", ""),
|
26
26
|
name: name
|
27
27
|
}.merge(payload)
|
28
28
|
end
|
@@ -36,7 +36,9 @@ module StepTrack
|
|
36
36
|
result = {step_count: steps.count}
|
37
37
|
result.merge!(steps.last || {})
|
38
38
|
steps.each_with_index do |step, i|
|
39
|
-
|
39
|
+
name = step[:name]
|
40
|
+
result.merge!(step.merge(i: i + 1).
|
41
|
+
map { |k, v| ["step_#{name}_#{k}".to_sym, v] }.to_h)
|
40
42
|
end
|
41
43
|
return track_ref[:callback].call(result)
|
42
44
|
end
|
data/lib/step_track/version.rb
CHANGED
data/test/step_track_test.rb
CHANGED
@@ -90,8 +90,9 @@ describe "StepTrack" do
|
|
90
90
|
it "enumerates every step into result" do
|
91
91
|
result = StepTrack.done("test")
|
92
92
|
expected_key_parts = [:name, :split, :duration, :caller]
|
93
|
-
|
94
|
-
|
93
|
+
|
94
|
+
["step", "last"].each_with_index do |n, i|
|
95
|
+
expected_keys = expected_key_parts.map { |k| "step_#{n}_#{k}".to_sym }
|
95
96
|
assert_equal expected_keys, expected_keys & result.keys
|
96
97
|
end
|
97
98
|
end
|