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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 223ca527f32902f873a8c4b34a8e083a6bb91ca4
4
- data.tar.gz: 1f3c345c51bfe5aa3959795824561ce433609e7c
3
+ metadata.gz: 44d2a673a0a4ad99bef64eb7c0b6938f87a30ede
4
+ data.tar.gz: 42f58e8beae25271da55980d72e4d1d35fb243dc
5
5
  SHA512:
6
- metadata.gz: 45ad270d69c98b573eea8b6bb53e747083e8a8511284726bac97737ced664aa8891a2bbd1cd1a68c4a3a9be0cc1470238a42c733ecf0a218e2c2f0c6fa00ee3a
7
- data.tar.gz: dafca62752e93766a0377533cd3e3fe6ed6a946b41fe473076452d95c124548fa5fbd6c3a56edeb062829c1fbd1cfa19230ae67f06cf07e45b261c112ec37062
6
+ metadata.gz: 67becd249f79ffd6e4ccf073190fa6b83a14b2e78b7d256e0fd19f254173629d5a1bc575946c2bbd85d665d664e94b5bca8edf91d4cc2d820e590940effbb833
7
+ data.tar.gz: b2d198521e9ada64b4a5b5159757b424b60143dcc5cb836b329dcb80b6a56ea63b7f04904573526e3c4f238c9e0a576dcd423417d9361b48689d442dd7f10036
@@ -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
- result.merge!(step.map { |k, v| ["step_#{i}_#{k}".to_sym, v] }.to_h)
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
@@ -1,3 +1,3 @@
1
1
  module StepTrack
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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
- 2.times do |i|
94
- expected_keys = expected_key_parts.map { |k| "step_#{i}_#{k}".to_sym }
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: step-track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Geier