enum_fields 0.4.1 → 0.4.2

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: 18fd94d3a61872ff4800c07619df202cc07042b9783bde8e01dc5536c4607fb1
4
- data.tar.gz: 4a51908ee73495023625864865863bff9ae851667a9db4ab18860008a135421d
3
+ metadata.gz: 3f68efaa8f90e2513096afc1c1238d51c8c0abf85830e7801ad31ecfca125b03
4
+ data.tar.gz: 5aaf0ad149d985c0bc692da2eaa8d5bfdbadd5e1fe3cc64bd7836ced15f5f938
5
5
  SHA512:
6
- metadata.gz: 26c5cf4fb41d9bb1e3026e55919981bfd2dedbfd5075f89813546c9aeec50974c95d5c905444a1e82cbb7fc90571ffe963186cf9e03b32ca9be0f71bd7b6befb
7
- data.tar.gz: 28d4711b052bab41d6b03a68d5d77ee1f9d846c4e406d9b239d0fc1d2bd2eaee5991c0b501f29ec566fcfc507ec8fa4b3fa2ee2fafe498e5bdb2996de0a892bd
6
+ metadata.gz: a6e3af5170942bab989dd920faed8a85740c9e26710bc3f55a7110ff509aa237e980cb892c69045586c60d391f7584ec636ca370d3d93003a84b5c988c7fac03
7
+ data.tar.gz: 303c15c3c46034e216874e1f8138f4f699727a8515819fbe9c398c5b2853b7e21045973919533cbe06fdc7fcd02fd8e0a9f35bb39b37992bf88060676b9985cb
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [X.X.X] - YYYY-MM-DD
9
9
 
10
+ ## [0.4.2] - 2026-07-13
11
+
12
+ - Fix `*_options` to emit each definition's stored `value` instead of its key, so options generated from array definitions or hash definitions with keys that differ from their values submit values the inclusion validation actually accepts
13
+ - Bump `required_ruby_version` to `>= 3.1` to match the anonymous block forwarding syntax already used by the gem, which raised `SyntaxError` on Ruby 2.7/3.0 despite the gemspec claiming support
14
+ - Fix README to document the singular `*_values`/`*_options` class methods (e.g. `Campaign.stage_values`) that the gem actually defines, instead of the nonexistent pluralized forms (e.g. `Campaign.stages_values`)
15
+
10
16
  ## [0.4.1] - 2026-03-26
11
17
 
12
18
  - Update `bin/ci` and `bin/release` to use new formatting functions
data/README.md CHANGED
@@ -4,7 +4,7 @@ Enhanced enum-like fields for ActiveRecord models with metadata support
4
4
 
5
5
  ## Requirements
6
6
 
7
- - Ruby >= 2.7.6
7
+ - Ruby >= 3.1
8
8
  - Rails >= 6.0 (ActiveRecord and ActiveSupport)
9
9
 
10
10
  ## Installation
@@ -181,10 +181,10 @@ Campaign.stages
181
181
  Campaign.stages_count # 3
182
182
 
183
183
  # Returns the values of the definitions
184
- Campaign.stages_values # ["draft", "scheduled", "completed"]
184
+ Campaign.stage_values # ["draft", "scheduled", "completed"]
185
185
 
186
186
  # Returns the options for form helpers
187
- Campaign.stages_options # [["Draft", "draft"], ["Scheduled", "scheduled"], ["Completed", "completed"]]
187
+ Campaign.stage_options # [["Draft", "draft"], ["Scheduled", "scheduled"], ["Completed", "completed"]]
188
188
 
189
189
  # Returns the value for a specific key
190
190
  Campaign.draft_stage_value # "draft"
@@ -59,8 +59,8 @@ module EnumFields
59
59
  end
60
60
 
61
61
  @model_class.define_singleton_method("#{@accessor}_options") do
62
- definition_data.map do |key, metadata|
63
- [metadata[:label], key.to_s]
62
+ definition_data.map do |_key, metadata|
63
+ [metadata[:label], metadata[:value]]
64
64
  end
65
65
  end
66
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EnumFields
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enum_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kinnell Shah
@@ -89,14 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 2.7.6
92
+ version: '3.1'
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '2.0'
98
98
  requirements: []
99
- rubygems_version: 4.0.9
99
+ rubygems_version: 3.6.9
100
100
  specification_version: 4
101
101
  summary: Enhanced enum-like fields for ActiveRecord models with metadata support
102
102
  test_files: []