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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14c71e9cd468dd53e36d2ff91e05d42a05f3adc2b77a206cb54a92d3ada5b2aa
4
- data.tar.gz: 8c74bf98bef6ea4be290669a45a27f0dd4ffdc22fa35bd77fb010aa7b0cb1c86
3
+ metadata.gz: 583aa220b4b5c76f2f63dc736c29bc28a4cd48d1552a44c282d9f9cd75d4cc2d
4
+ data.tar.gz: 6fcc67385226a12b6018041d3df754bf93fe53b2306d87a917c84421c16fa9cf
5
5
  SHA512:
6
- metadata.gz: 9a8089db24fa96a1791ac596b2287d0a934091c6b153fcc5714ef93f04539b615bf7aa1c3f6b362577a8cc36f93e217ffd63d2d0c4df2ff03a141ab303f1d959
7
- data.tar.gz: e54556d56355788621c6ed9144beaa00dd20bdaa42947b27627b9495c4e294dbb2f022e7590dcb28addab75f689effb8464d38599559607e95cde44b71010293
6
+ metadata.gz: 2d957847070045995c509a2a4f53ee5d2e7f8deeb90d26c5654fc1a289aca8fcf79cd3eec008052f2b39b332b01b1aab8617e73639fd818909a68e135734a258
7
+ data.tar.gz: e98551bb3950d30266ef7b83779612c708c868c10a6c7c919057f323361f739a95a5f7a40bffd760f30f98acd536abad4d2b03fb060e90899abdc5fbc303e845
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.5
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
- ## [Unreleased]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusHelpers
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -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, :cache_mutex
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.cache_mutex.synchronize do
143
- StimulusHelpers.dasherized_cache[string] ||= string.dasherize
144
- end
144
+ StimulusHelpers.dasherized_cache[string] ||= string.dasherize
145
145
  end
146
146
  end
@@ -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", "~> 5.0"
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.2.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: 2025-06-02 00:00:00.000000000 Z
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: '5.0'
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: '5.0'
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: 3.5.16
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: []