ms_header_trail 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: e50f67baf8272084c90750b118a1f359c73c0b4e5449970d355be9600d3ff62a
4
- data.tar.gz: f6eac97b73cf3debb3bd217cb7c506a48aca92e8e684c1a6a53223c92b78eb87
3
+ metadata.gz: b6f5b7d930f103822d5ab65e2ea7d10635002ea286dd7ab4ceffa8b00a2fe64c
4
+ data.tar.gz: e05ef826175b047c7550fdee630c4273bbc032886d9e899596a0b6f179786c00
5
5
  SHA512:
6
- metadata.gz: 3aa6b704a71c78e110508b4f32a424dcf5cb515b908a10958fd2e96922c6f60ffef2765cfc254bfd19c862e9289404b9cbc1e3c1bbe6826c8096d0d2175ae306
7
- data.tar.gz: e341ffb0e9ef3060d7d7146e882e5d1342a169e34e6de396fd1e33a5597542bb8db9aebf87100b798431001247890b60efec08aa443fff520a39792520be2a64
6
+ metadata.gz: cf12574b911a2ccb5ea20983df7325f56618ddc8319b5bbe687d058ce417dc4f8f11e9b23c763f86c7b03c9167682a95c45d6c135213ae42b3b51eb59a675e1c
7
+ data.tar.gz: 4ee19e03f861239819ecb1575c10a9b7cb2e0e59be25cd4c98792055a2c844433af394ffbd3dfa3026f89bfa1dd02e13ae19b5b49f645710603c1ba6412fc561
data/CHANGELOG.md CHANGED
@@ -1,4 +1,6 @@
1
- ## [Unreleased]
1
+ ## [0.2.2] - 2024-06-04
2
+ - Reseting current thread data before start another
3
+ process into rack middleware
2
4
 
3
5
  ## [0.2.1] - 2024-06-04
4
6
  - Allow to use ruby >= 2.4
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MsHeaderTrail
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
@@ -25,24 +25,20 @@ module MsHeaderTrail
25
25
  # Public: Retrive the stored parameters, which was set by user
26
26
  # during the Rack middleware, faraday connection or manually
27
27
  def retrieve
28
- Thread.current
29
- .keys
30
- .select { |key| start_with?(key, configuration.prefix_keyname) }
31
- .each_with_object({}) { |key, memo| memo[configuration.from_store(key)] = get(key) }
28
+ current_thread_data
29
+ .each_with_object({}) { |key, memo| memo[configuration.from_store(key)] = get(key) }
32
30
  end
33
31
 
34
- # Public: Execute a block code after data collected
32
+ # Public: Execute a block code after reset and collect data
35
33
  def with(attributes)
34
+ reset
36
35
  collect(attributes)
37
36
  yield
38
37
  end
39
38
 
40
39
  # Public: Reset values into current thread
41
40
  def reset
42
- Thread.current
43
- .keys
44
- .select { |key| start_with?(key, configuration.prefix_keyname) }
45
- .each { |key| Thread.current[key] = nil }
41
+ current_thread_data.each { |key| Thread.current[key] = nil }
46
42
  end
47
43
 
48
44
  # Public: Retrieve the given key
@@ -72,6 +68,12 @@ module MsHeaderTrail
72
68
 
73
69
  private
74
70
 
71
+ def current_thread_data
72
+ Thread.current
73
+ .keys
74
+ .select { |key| start_with?(key, configuration.prefix_keyname) }
75
+ end
76
+
75
77
  def start_with?(value, expected)
76
78
  value.to_s.start_with?(expected)
77
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms_header_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adriano Dadario
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-19 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.0.9
111
+ rubygems_version: 3.3.26
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Transport collected data through HTTP header from microservices requests.