tablesalt 0.29.1 → 0.29.3

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: '0728064921316a39a18876f019d567fe175842e0021db39ed44184c96fa853e6'
4
- data.tar.gz: 12594d63e88b66f2cffc3a633dcc8c72961745d24b2aca0080b0b0f988982b16
3
+ metadata.gz: e16a91ec73664aa6fc914ff28dc0d64a49c16afda07322564996f0d1ece68549
4
+ data.tar.gz: d5488fd06f022595a9cffd90ff101f0252c74466589c3c562115d13ace8bc8e4
5
5
  SHA512:
6
- metadata.gz: 9615d887524c3755b23c6ab5129ee07a51c05f5e4c0ec149160ea6546d546b42a54baf108acb10cf7be453c4f319450be0360377a19970ef58a406545b3d3368
7
- data.tar.gz: 6d26e263e7bf0cc8c8b43c8582eb5048ba5ce267fc6f7ea68ba045fce36d2c5722ca943b9637d31d8a54e49b0d5f8d7b9efa39945343c742eb19f9eb6099c9d8
6
+ metadata.gz: d3b0683d770b5a502ea3d039d93e8433a41ab523b33baa47e63e294ac505b3be580e8286dcb6922298b921bd45d731ef50a5c3244706ba6ee48a4ea07342f645
7
+ data.tar.gz: 575a3cedae4c386ff086238f7505bc7f72905a752e33801377d56c5f47c415b76a48722f4d4e883dece6d898c59e4346a81b32c9a8419763972fc5ad58843939
data/README.md CHANGED
@@ -127,7 +127,7 @@ CurrentUser.current_user
127
127
  Yep, when you mess with thread variables, you need to think about thread safety. For Rack applications, `ThreadAccessor` ships with a Rack middleware component:
128
128
  ```ruby
129
129
  # in config/initializers/rack.rb, or config/initializers/tablesalt.rb, or anywhere else in your boot path:
130
- config.middleware.use TableSalt::ThreadAccessor::RackMiddleware
130
+ Rails.application.config.middleware.use Tablesalt::ThreadAccessor::RackMiddleware
131
131
  ```
132
132
 
133
133
  If your application isn't on Rack, you'll need to add a little more code manually to take care of this:
@@ -24,15 +24,12 @@ module Tablesalt
24
24
 
25
25
  _class_pass_methods << method
26
26
 
27
- define_singleton_method method do |*args, **attrs, &block|
28
- # TODO: remove this if branch when 2.6 support is removed
29
- if RUBY_VERSION < "2.7.0" && attrs.empty?
30
- new(*args).public_send(to || method, &block)
27
+ define_singleton_method method do |*args, **kwargs, &block|
31
28
  # TODO: remove this if branch when 2.7 support is removed
32
- elsif RUBY_VERSION < "3.0.0" && args.empty? && attrs.empty?
29
+ if RUBY_VERSION < "3.0.0" && args.empty? && kwargs.empty?
33
30
  new.public_send(to || method, &block)
34
31
  else
35
- new(*args, **attrs).public_send(to || method, &block)
32
+ new(*args, **kwargs).public_send(to || method, &block)
36
33
  end
37
34
  end
38
35
  end
@@ -63,9 +63,9 @@ module Tablesalt
63
63
  # => "bar"
64
64
  #
65
65
  # @param method [String, Symbol] The name of the reader method
66
- # @param thread_key [String, Symbol] The key to read from Thread.current
66
+ # @param thread_key [String, Symbol] The key to read from Thread.current. Default: <method>
67
67
  # @option :private [Boolean] If true, both defined methods will be private. Default: true
68
- def thread_reader(method, thread_key, **options)
68
+ def thread_reader(method, thread_key = method, **options)
69
69
  define_method(method) { __thread_accessor_store_instance__[thread_key] }
70
70
  define_singleton_method(method) { __thread_accessor_store_instance__[thread_key] }
71
71
 
@@ -101,9 +101,9 @@ module Tablesalt
101
101
  # to clear the thread store themselves.
102
102
  #
103
103
  # @param method [String, Symbol] The name of the writer method
104
- # @param thread_key [String, Symbol] The key to write to on Thread.current
104
+ # @param thread_key [String, Symbol] The key to write to on Thread.current. Default: <method>
105
105
  # @option :private [Boolean] If true, both defined methods will be private. Default: true
106
- def thread_writer(method, thread_key, **options)
106
+ def thread_writer(method, thread_key = method, **options)
107
107
  method_name = "#{method}="
108
108
 
109
109
  define_method(method_name) { |value| __thread_accessor_store_instance__[thread_key] = value }
@@ -136,9 +136,9 @@ module Tablesalt
136
136
  # => "baz"
137
137
  #
138
138
  # @param method [String, Symbol] The name of the writer method
139
- # @param thread_key [String, Symbol] The key to write to on Thread.current
139
+ # @param thread_key [String, Symbol] The key to write to on Thread.current. Default: <method>
140
140
  # @option :private [Boolean] If true, all defined methods will be private. Default: true
141
- def thread_accessor(method, thread_key, **options)
141
+ def thread_accessor(method, thread_key = method, **options)
142
142
  thread_reader(method, thread_key, **options)
143
143
  thread_writer(method, thread_key, **options)
144
144
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Tablesalt
4
4
  # This constant is managed by spicerack
5
- VERSION = "0.29.1"
5
+ VERSION = "0.29.3"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tablesalt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.1
4
+ version: 0.29.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Minneti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.1
19
+ version: 6.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.1
26
+ version: 6.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 5.2.1
33
+ version: 6.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 5.2.1
40
+ version: 6.1.0
41
41
  description: A package of helpers that introduce some conventions and convenience
42
42
  for common behaviors
43
43
  email:
@@ -76,7 +76,7 @@ metadata:
76
76
  homepage_uri: https://github.com/RubyAfterAll/spicerack/tree/main/tablesalt
77
77
  source_code_uri: https://github.com/RubyAfterAll/spicerack/tree/main/tablesalt
78
78
  changelog_uri: https://github.com/RubyAfterAll/spicerack/blob/main/tablesalt/CHANGELOG.md
79
- documentation_uri: https://www.rubydoc.info/gems/tablesalt/0.29.1
79
+ documentation_uri: https://www.rubydoc.info/gems/tablesalt/0.29.3
80
80
  post_install_message:
81
81
  rdoc_options: []
82
82
  require_paths:
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubygems_version: 3.3.7
95
+ rubygems_version: 3.5.3
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Miscellaneous helper modules, POROs, and more, that standardize common behavior