stimulus_helpers 0.2.0 → 0.3.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 +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +5 -2
- data/lib/stimulus_helpers/version.rb +1 -1
- data/lib/stimulus_helpers.rb +6 -6
- data/stimulus_helpers.gemspec +1 -1
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 583aa220b4b5c76f2f63dc736c29bc28a4cd48d1552a44c282d9f9cd75d4cc2d
|
|
4
|
+
data.tar.gz: 6fcc67385226a12b6018041d3df754bf93fe53b2306d87a917c84421c16fa9cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d957847070045995c509a2a4f53ee5d2e7f8deeb90d26c5654fc1a289aca8fcf79cd3eec008052f2b39b332b01b1aab8617e73639fd818909a68e135734a258
|
|
7
|
+
data.tar.gz: e98551bb3950d30266ef7b83779612c708c868c10a6c7c919057f323361f739a95a5f7a40bffd760f30f98acd536abad4d2b03fb060e90899abdc5fbc303e845
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.1
|
data/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [0.3.0] - 2026-04-18
|
|
9
|
+
|
|
10
|
+
### Performance
|
|
11
|
+
- Drop the `Mutex` from `cached_dasherize`. The cached operation is deterministic (same input always yields same output), so a concurrent duplicate compute produces the same value and the overwrite is harmless. Ruby Hash writes are atomic enough at the VM level for this pattern. Saves a `Mutex#synchronize` block invocation on every call — hundreds per heavy page render in consumer apps.
|
|
9
12
|
|
|
10
13
|
## [0.2.0] - 2025-01-06
|
|
11
14
|
|
|
@@ -28,4 +31,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
28
31
|
- `stimulus_param(controller, name, value)` and `stimulus_params(controller, params)` - Parameter bindings
|
|
29
32
|
- `stimulus_outlet(controller, name, value)` and `stimulus_outlets(controller, outlets)` - Outlet bindings
|
|
30
33
|
- Automatic JSON serialization for complex values (Arrays and Hashes)
|
|
31
|
-
- Automatic dasherization of attribute names following Stimulus conventions
|
|
34
|
+
- Automatic dasherization of attribute names following Stimulus conventions
|
data/lib/stimulus_helpers.rb
CHANGED
|
@@ -5,12 +5,14 @@ require "active_support/core_ext/string/inflections"
|
|
|
5
5
|
require "json"
|
|
6
6
|
|
|
7
7
|
module StimulusHelpers
|
|
8
|
-
# Cache for dasherized keys to avoid repeated string operations
|
|
8
|
+
# Cache for dasherized keys to avoid repeated string operations.
|
|
9
|
+
# No mutex: writes are idempotent (same input → same output), so a
|
|
10
|
+
# concurrent race just does the work twice and overwrites harmlessly.
|
|
11
|
+
# Ruby Hash writes are atomic at the VM level for this simple case.
|
|
9
12
|
@dasherized_cache = {}
|
|
10
|
-
@cache_mutex = Mutex.new
|
|
11
13
|
|
|
12
14
|
class << self
|
|
13
|
-
attr_reader :dasherized_cache
|
|
15
|
+
attr_reader :dasherized_cache
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
# @see https://blog.saeloun.com/2021/09/28/ruby-allow-value-omission-in-hash-literals
|
|
@@ -139,8 +141,6 @@ module StimulusHelpers
|
|
|
139
141
|
end
|
|
140
142
|
|
|
141
143
|
def cached_dasherize(string)
|
|
142
|
-
StimulusHelpers.
|
|
143
|
-
StimulusHelpers.dasherized_cache[string] ||= string.dasherize
|
|
144
|
-
end
|
|
144
|
+
StimulusHelpers.dasherized_cache[string] ||= string.dasherize
|
|
145
145
|
end
|
|
146
146
|
end
|
data/stimulus_helpers.gemspec
CHANGED
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
|
|
31
31
|
spec.add_development_dependency "bundler"
|
|
32
32
|
spec.add_development_dependency "rake"
|
|
33
|
-
spec.add_development_dependency "minitest", "~>
|
|
33
|
+
spec.add_development_dependency "minitest", "~> 6.0"
|
|
34
34
|
|
|
35
35
|
spec.add_development_dependency "lefthook"
|
|
36
36
|
spec.add_development_dependency "rubocop-rails_config"
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stimulus_helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomas Celizna
|
|
8
8
|
- Asger Behncke Jacobsen
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: activesupport
|
|
@@ -59,14 +58,14 @@ dependencies:
|
|
|
59
58
|
requirements:
|
|
60
59
|
- - "~>"
|
|
61
60
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '
|
|
61
|
+
version: '6.0'
|
|
63
62
|
type: :development
|
|
64
63
|
prerelease: false
|
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
65
|
requirements:
|
|
67
66
|
- - "~>"
|
|
68
67
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '
|
|
68
|
+
version: '6.0'
|
|
70
69
|
- !ruby/object:Gem::Dependency
|
|
71
70
|
name: lefthook
|
|
72
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -122,7 +121,6 @@ metadata:
|
|
|
122
121
|
homepage_uri: https://github.com/tomasc/stimulus_helpers
|
|
123
122
|
source_code_uri: https://github.com/tomasc/stimulus_helpers
|
|
124
123
|
changelog_uri: https://github.com/tomasc/stimulus_helpers/CHANGELOG.md
|
|
125
|
-
post_install_message:
|
|
126
124
|
rdoc_options: []
|
|
127
125
|
require_paths:
|
|
128
126
|
- lib
|
|
@@ -137,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
137
135
|
- !ruby/object:Gem::Version
|
|
138
136
|
version: '0'
|
|
139
137
|
requirements: []
|
|
140
|
-
rubygems_version:
|
|
141
|
-
signing_key:
|
|
138
|
+
rubygems_version: 4.0.5
|
|
142
139
|
specification_version: 4
|
|
143
140
|
summary: Helper methods for stimulus controllers.
|
|
144
141
|
test_files: []
|