thread_local_var_accessors 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4537e0db3960367d75a6ab4d731026c6a425e315816bf0523d078b563b90a09a
4
- data.tar.gz: d270efc557c3b04f41ae9adf7850157d98c793a7d57cd025e8c88a40d2aaa154
3
+ metadata.gz: 02fb38d4a5adc85849626d020e688f2686990c14a4784d3a52efd7350a857058
4
+ data.tar.gz: '0729b1cf7becd14c4d054aa0cc94f8418180f618744db6ea0f13d77be0282f30'
5
5
  SHA512:
6
- metadata.gz: b1ad3ff8ce74641cdb6956fe084d8bd69e2712b002805302c2ca3550d82591e2874e94322dbf3ba4123f70f8185318fb05c6ef51e8527ce6145361f72347fb64
7
- data.tar.gz: 16ad94b606dfc4249bf344fcd859c1db7929bd026680fc8ef885e6768097c20cfbbc4753543c4989fea1095ce2876fbd525b5ba9090570fd117d79936446838b
6
+ metadata.gz: f428c335a4ff263984b7c0cc02f82f136f9e6a580d5c17f7bb76dddf8a855db4acb51fd9c5bdccffc27a2a9f84b9b2046feea83607779f7aab87e039f982f988
7
+ data.tar.gz: b936358a0f74fb0e97dfa60b118172d5ea4cc3c4fc0c66e92a771b8f7f4f9f225e89145581f80ec44ffd6e29d68ad3fd8ac839ec01b453ee51b3c540484507f1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ 2024-07-24: Version 1.4.0
2
+ - updated concurrent-ruby to 1.3.3 (from 1.2.2)
3
+ - updated development gems to latest versions
4
+ - removed innocuous misplaced value
5
+ - simplified the CI release steps
6
+
7
+ 2024-05-09: Version 1.3.1
8
+ - DRYed up the `tlv_default` method
9
+ - Changed CI to support "release" task on the main branch
10
+ - Added more tasks to the Rakefile
11
+ - Added RELEASES to the version file.
12
+ - Updated the ruby version to 3.1
13
+
1
14
  2023-05-04: Version 1.0.0
2
15
  - added support for default values:
3
16
  - renamed `tlv_new` to `tlv_init` (leaving `tlv_new` as an alias)
data/Gemfile.lock CHANGED
@@ -1,68 +1,73 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- thread_local_var_accessors (1.3.0)
4
+ thread_local_var_accessors (1.4.0)
5
5
  concurrent-ruby
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
- builder (3.2.4)
11
+ builder (3.3.0)
12
12
  byebug (11.1.3)
13
13
  coderay (1.1.3)
14
- concurrent-ruby (1.2.2)
15
- diff-lcs (1.5.0)
14
+ concurrent-ruby (1.3.3)
15
+ diff-lcs (1.5.1)
16
16
  docile (1.4.0)
17
17
  fuubar (2.5.1)
18
18
  rspec-core (~> 3.0)
19
19
  ruby-progressbar (~> 1.4)
20
- json (2.6.3)
21
- method_source (1.0.0)
22
- parallel (1.22.1)
23
- parser (3.2.1.1)
20
+ json (2.7.2)
21
+ language_server-protocol (3.17.0.3)
22
+ method_source (1.1.0)
23
+ parallel (1.25.1)
24
+ parser (3.3.4.0)
24
25
  ast (~> 2.4.1)
26
+ racc
25
27
  pry (0.14.2)
26
28
  coderay (~> 1.1)
27
29
  method_source (~> 1.0)
28
30
  pry-byebug (3.10.1)
29
31
  byebug (~> 11.0)
30
32
  pry (>= 0.13, < 0.15)
33
+ racc (1.8.0)
31
34
  rainbow (3.1.1)
32
- rake (13.0.6)
35
+ rake (13.2.1)
33
36
  redcarpet (3.6.0)
34
- regexp_parser (2.7.0)
35
- rexml (3.2.5)
36
- rspec (3.12.0)
37
- rspec-core (~> 3.12.0)
38
- rspec-expectations (~> 3.12.0)
39
- rspec-mocks (~> 3.12.0)
40
- rspec-core (3.12.1)
41
- rspec-support (~> 3.12.0)
42
- rspec-expectations (3.12.2)
37
+ regexp_parser (2.9.2)
38
+ rexml (3.3.2)
39
+ strscan
40
+ rspec (3.13.0)
41
+ rspec-core (~> 3.13.0)
42
+ rspec-expectations (~> 3.13.0)
43
+ rspec-mocks (~> 3.13.0)
44
+ rspec-core (3.13.0)
45
+ rspec-support (~> 3.13.0)
46
+ rspec-expectations (3.13.1)
43
47
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.12.0)
45
- rspec-mocks (3.12.4)
48
+ rspec-support (~> 3.13.0)
49
+ rspec-mocks (3.13.1)
46
50
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.12.0)
48
- rspec-support (3.12.0)
51
+ rspec-support (~> 3.13.0)
52
+ rspec-support (3.13.1)
49
53
  rspec_junit (4.0.4)
50
54
  builder (>= 3.2.2)
51
55
  rspec (>= 3.3.0)
52
56
  rspec_junit_formatter (0.6.0)
53
57
  rspec-core (>= 2, < 4, != 2.12.0)
54
- rubocop (1.48.1)
58
+ rubocop (1.65.0)
55
59
  json (~> 2.3)
60
+ language_server-protocol (>= 3.17.0)
56
61
  parallel (~> 1.10)
57
- parser (>= 3.2.0.0)
62
+ parser (>= 3.3.0.2)
58
63
  rainbow (>= 2.2.2, < 4.0)
59
- regexp_parser (>= 1.8, < 3.0)
64
+ regexp_parser (>= 2.4, < 3.0)
60
65
  rexml (>= 3.2.5, < 4.0)
61
- rubocop-ast (>= 1.26.0, < 2.0)
66
+ rubocop-ast (>= 1.31.1, < 2.0)
62
67
  ruby-progressbar (~> 1.7)
63
68
  unicode-display_width (>= 2.4.0, < 3.0)
64
- rubocop-ast (1.28.0)
65
- parser (>= 3.2.1.0)
69
+ rubocop-ast (1.31.3)
70
+ parser (>= 3.3.1.0)
66
71
  ruby-progressbar (1.13.0)
67
72
  simplecov (0.22.0)
68
73
  docile (~> 1.1)
@@ -70,15 +75,16 @@ GEM
70
75
  simplecov_json_formatter (~> 0.1)
71
76
  simplecov-html (0.12.3)
72
77
  simplecov_json_formatter (0.1.4)
73
- spring (4.1.1)
78
+ spring (4.2.1)
79
+ strscan (3.1.0)
74
80
  terminal-notifier-guard (1.7.0)
75
- unicode-display_width (2.4.2)
76
- webrick (1.7.0)
77
- yard (0.9.28)
78
- webrick (~> 1.7.0)
81
+ unicode-display_width (2.5.0)
82
+ yard (0.9.36)
79
83
 
80
84
  PLATFORMS
81
85
  x86_64-darwin-21
86
+ x86_64-darwin-23
87
+ x86_64-linux
82
88
 
83
89
  DEPENDENCIES
84
90
  bundler
data/Rakefile CHANGED
@@ -1,19 +1,37 @@
1
1
  # Rakefile for thread_local_var_accessors
2
- require "bundler/gem_tasks"
3
- require "rspec/core/rake_task"
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
4
  require 'yard'
5
5
 
6
+ namespace :spec do
7
+ desc 'run tests with code coverage'
8
+ task :coverage do
9
+ sh 'COVERAGE=1 bundle exec rake spec'
10
+ end
11
+ end
12
+
13
+ task build: %i[bundle:add_linux]
14
+ task install: %i[build spec]
15
+ task release: %i[build spec]
16
+
6
17
  # Local CI testing
7
18
 
8
19
  namespace :ci do
9
- desc "Check CIRCLECI config"
20
+ desc 'Check CIRCLECI config'
10
21
  task :check do
11
- sh "circleci config validate", verbose: true
22
+ sh 'circleci config validate', verbose: true
12
23
  end
13
24
 
14
- desc "Run CIRCLECI config locally"
25
+ desc 'Run CIRCLECI config locally'
15
26
  task :local do
16
- sh "circleci local execute", verbose: true
27
+ sh 'circleci local execute', verbose: true
28
+ end
29
+ end
30
+
31
+ namespace :bundle do
32
+ desc 'add linux platform to Gemfile.lock'
33
+ task :add_linux do
34
+ sh "grep -s 'x86_64-linux' Gemfile.lock >/dev/null || bundle lock --add-platform x86_64-linux"
17
35
  end
18
36
  end
19
37
 
@@ -22,7 +40,7 @@ end
22
40
  RSpec::Core::RakeTask.new(:spec)
23
41
 
24
42
  namespace :spec do
25
- desc "run Simplecov"
43
+ desc 'run Simplecov'
26
44
  task :coverage do
27
45
  sh 'CODE_COVERAGE=1 bundle exec rake spec'
28
46
  end
@@ -1,3 +1,9 @@
1
1
  module ThreadLocalVarAccessors
2
- VERSION = '1.3.0'
2
+ RELEASES = [
3
+ ['1.4.0', '2024-07-24'],
4
+ ['1.3.1', '2024-05-09'],
5
+ ['1.3.0', '2023-05-04']
6
+ ].freeze
7
+
8
+ VERSION = RELEASES[0][0]
3
9
  end
@@ -160,7 +160,7 @@ require 'concurrent-ruby'
160
160
  #
161
161
  # def timeout=(value)
162
162
  # var = instance_variable_get(:@timeout) ||
163
- # instance_variable_get(:@timeout, Concurrent::ThreadLocalVar.new)
163
+ # instance_variable_set(:@timeout, Concurrent::ThreadLocalVar.new)
164
164
  # var.value = block_given? ? yield(var.value) : value
165
165
  # end
166
166
  #
@@ -277,7 +277,7 @@ module ThreadLocalVarAccessors
277
277
  # Creates a new TLVar with the given default value or block.
278
278
  # Equivalent to:
279
279
  # @name = ThreadLocalVar.new(block_given? ? yield : default)
280
- def tlv_new(name, default=nil, &block)
280
+ def tlv_new(name, default = nil, &block)
281
281
  instance_variable_set(
282
282
  name.to_ivar,
283
283
  Concurrent::ThreadLocalVar.new(default, &block)
@@ -291,7 +291,7 @@ module ThreadLocalVarAccessors
291
291
  # @name ||= ThreadLocalVar.new
292
292
  # @name.instance_variable_set(:@default, block_given? ? yield : default)
293
293
  # @name.value
294
- def tlv_init(name, default=nil, &block)
294
+ def tlv_init(name, default = nil, &block)
295
295
  tlv_set_default(name, default, &block)
296
296
  tlv_get(name)
297
297
  end
@@ -310,18 +310,15 @@ module ThreadLocalVarAccessors
310
310
  # Sets the default value or block for the TLV _(which is applied across all threads)_.
311
311
  # Creates a new TLV if the instance variable is not initialized.
312
312
  # @return [Object] the effective default value of the TLV instance variable
313
- def tlv_set_default(name, default=nil, &block)1
313
+ def tlv_set_default(name, default = nil, &block)
314
314
  tlv = instance_variable_get(name.to_ivar)
315
315
  if tlv
316
- raise ArgumentError, "tlv_set_default: can only use a default or a block, not both" if default && block
316
+ raise ArgumentError, 'tlv_set_default: can only use a default or a block, not both' if default && block
317
317
 
318
- if block
319
- tlv.instance_variable_set(:@default_block, block)
320
- tlv.instance_variable_set(:@default, nil)
321
- else
322
- tlv.instance_variable_set(:@default_block, nil)
323
- tlv.instance_variable_set(:@default, default)
324
- end
318
+ # in both cases, the default is set to the given value, only one of which
319
+ # can be given at a time.
320
+ tlv.instance_variable_set(:@default_block, block)
321
+ tlv.instance_variable_set(:@default, default)
325
322
  tlv
326
323
  else
327
324
  tlv = tlv_new(name, default, &block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thread_local_var_accessors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Stebbens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-10 00:00:00.000000000 Z
11
+ date: 2024-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  requirements: []
245
- rubygems_version: 3.1.6
245
+ rubygems_version: 3.4.19
246
246
  signing_key:
247
247
  specification_version: 4
248
248
  summary: Ruby gem to make ThreadLocalVars easy to use