step-track 0.4.0 → 0.4.1

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: 4a0bf2ec6b3a6e6f8598448e7e1ddbfd6fda1c12
4
- data.tar.gz: 83adeac1520de8022874b87ce25f007759a9ab06
3
+ metadata.gz: ae905646f8383148b07b27620e6dcd11d0bf9830
4
+ data.tar.gz: b6de9e4901d83d3e340ee2cc0da0bc673da829f0
5
5
  SHA512:
6
- metadata.gz: 1dcb19876dbc655a30629b8e406a129928721132597b906ed95a92accf6e17b7221f0e904c201555fb3b258bb002f21a00d8c24d0302f9bb55dd1bdf9d5ccb56
7
- data.tar.gz: 975b29eec0db2f6fab3b318026e0ec27dd040605c21edc9cbd8e0f203846b13761c73deb7d2ec1366fd2838587f14b69414cf8ab9588d100ab7d89d0100b607a
6
+ metadata.gz: 8b3d52bd83d3964229b20cea18e9d372bc5bf893ad1e561811fe7faa5fb578a7aebb45e8bd0bcf1b482a00bb00d0706e2d07214c0f1e29c2963718ecbc7c67d4
7
+ data.tar.gz: 8fdf95bdeb8036ef90bdbd488bca023ba1a0d609a1d5e06b877b783f9ad090dbd05a0b662673654d8867bffe6d9164b7121e4cc3cebebc8a21114b5640256ef0
@@ -1,3 +1,3 @@
1
1
  module StepTrack
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/step_track.rb CHANGED
@@ -4,14 +4,15 @@ module StepTrack
4
4
  extend self
5
5
 
6
6
  REF = "step_track/%{track}"
7
+ DEFAULT_CONFIG = {merge_key: :merge, error_key: :error}.freeze
7
8
 
8
- def init(track, config={merge_key: :merge, error_key: :error})
9
+ def init(track, config={})
9
10
  raise ArgumentError, "callback block required" unless block_given?
10
11
  Thread.current[ref(track)] = {
11
12
  steps: [],
12
13
  callback: Proc.new,
13
14
  time: Time.now
14
- }.merge(config)
15
+ }.merge(DEFAULT_CONFIG).merge(config)
15
16
  end
16
17
 
17
18
  def push(track, name, payload={})
@@ -36,7 +37,11 @@ module StepTrack
36
37
  steps = track_ref.delete(:steps)
37
38
  steps.each { |step| step.delete(:time) }
38
39
  result = {step_count: steps.count}
39
- last_step = steps.last&.dup || {}
40
+ if err = steps.detect { |s| s.key?(track_ref[:error_key]) }
41
+ last_step = err.dup
42
+ else
43
+ last_step = steps.last&.dup || {}
44
+ end
40
45
  last_step[:final_step_name] = last_step.delete(:step_name)
41
46
  result.merge!(last_step)
42
47
  steps.each_with_index do |step, i|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: step-track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Geier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  version: '0'
56
56
  requirements: []
57
57
  rubyforge_project:
58
- rubygems_version: 2.5.1
58
+ rubygems_version: 2.5.2.3
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: Tracks data fragments across the application