enum-i18n 0.1.1 → 0.2.1
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 +5 -5
- data/.gitignore +6 -0
- data/CHANGELOG.md +29 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/DEPRECATION.md +77 -0
- data/README.md +44 -1
- data/enum-i18n.gemspec +20 -16
- data/lib/enum-i18n/version.rb +1 -1
- data/lib/enum-i18n.rb +7 -2
- metadata +17 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 65d1dc220cdd7b8b932e8a8db28dbf38c86f46a0ea324a29eeb9b29ea429951a
|
4
|
+
data.tar.gz: de746cb94fd38ba666aace4bf04907a71ca75f11cd993622e4ca66b47102c29b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebd52906313d18db9f73c7aeaa6ae5172327aefdc97b69128a2a42ad2cf287295744335a172fa2cfe62c899b327dc1acd8a243eb579ff4721badaf7c6e1d96ff
|
7
|
+
data.tar.gz: 929fd2103b7836ec8241e715e42ef8baaccb0895fc0b37e40c31ff50434c06f0e04a7b589eae305a0fba2ee32593b0d5ba30bb6f720d2b35ef00d66df4ceaf22
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [DEPRECATED]
|
4
|
+
|
5
|
+
⚠️ **This gem is deprecated and will be archived on or after August 31, 2025.** ⚠️
|
6
|
+
|
7
|
+
### Why Deprecated?
|
8
|
+
- Rails 7.1+ provides better built-in alternatives using `human_attribute_name`
|
9
|
+
- Alternative gems like `enum_help` and `enumerize` are more actively maintained
|
10
|
+
- Consider migrating to Rails built-in solutions or alternative gems
|
11
|
+
|
12
|
+
### Migration Path
|
13
|
+
- **Rails 7.1+**: Use `User.human_attribute_name("status.#{@user.status}")`
|
14
|
+
- **Alternative gems**: Consider `enum_help` or `enumerize`
|
15
|
+
|
16
|
+
---
|
17
|
+
|
1
18
|
# CHANGELOG
|
2
19
|
|
20
|
+
# v0.2.1
|
21
|
+
* Update contact information to use GitHub issues instead of email addresses
|
22
|
+
* Remove email addresses from gemspec and documentation
|
23
|
+
* Add bug tracker and source code URIs to gemspec metadata
|
24
|
+
* Update .gitignore to exclude gem files
|
25
|
+
|
26
|
+
# v0.2.0
|
27
|
+
* Mark gem as deprecated
|
28
|
+
* Add deprecation warning to gemspec and README
|
29
|
+
* Set archive date to August 31, 2025
|
30
|
+
* Update documentation with migration guide
|
31
|
+
|
3
32
|
# v0.1.1
|
4
33
|
[full changelog]( https://github.com/amyroi/enum-i18n/compare/v0.1.0...v0.1.1)
|
5
34
|
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team via GitHub issues at https://github.com/amyroi/enum-i18n/issues. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/DEPRECATION.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Deprecation Notice
|
2
|
+
|
3
|
+
## ⚠️ This gem is deprecated and will be archived on or after August 31, 2025 ⚠️
|
4
|
+
|
5
|
+
## Why is this gem deprecated?
|
6
|
+
|
7
|
+
The `enum-i18n` gem was created to provide I18n support for ActiveRecord enums when Rails didn't have built-in alternatives. However, the Rails ecosystem has evolved, and there are now better solutions available.
|
8
|
+
|
9
|
+
## What are the alternatives?
|
10
|
+
|
11
|
+
### 1. Rails Built-in (Recommended for Rails 7.1+)
|
12
|
+
|
13
|
+
Rails 7.1+ provides the `human_attribute_name` method which can handle enum values:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
class User < ApplicationRecord
|
17
|
+
enum :status, [:active, :inactive, :pending]
|
18
|
+
end
|
19
|
+
|
20
|
+
# In your locale files (config/locales/en.yml)
|
21
|
+
en:
|
22
|
+
activerecord:
|
23
|
+
attributes:
|
24
|
+
user:
|
25
|
+
statuses:
|
26
|
+
active: "Active"
|
27
|
+
inactive: "Inactive"
|
28
|
+
pending: "Pending"
|
29
|
+
|
30
|
+
# Usage
|
31
|
+
User.human_attribute_name("statuses.#{@user.status}")
|
32
|
+
# => "Active" (if @user.status is :active)
|
33
|
+
```
|
34
|
+
|
35
|
+
### 2. Alternative Gems
|
36
|
+
|
37
|
+
#### enum_help
|
38
|
+
```ruby
|
39
|
+
gem 'enum_help'
|
40
|
+
|
41
|
+
# Provides similar functionality with more features
|
42
|
+
@user.status_text # => "Active"
|
43
|
+
```
|
44
|
+
|
45
|
+
#### enumerize
|
46
|
+
```ruby
|
47
|
+
gem 'enumerize'
|
48
|
+
|
49
|
+
# More feature-rich enum management
|
50
|
+
enumerize :status, in: [:active, :inactive, :pending]
|
51
|
+
@user.status.text # => "Active"
|
52
|
+
```
|
53
|
+
|
54
|
+
## Migration Timeline
|
55
|
+
|
56
|
+
- **August 31, 2025 or later**: Gem will be archived and removed from RubyGems
|
57
|
+
|
58
|
+
## How to migrate
|
59
|
+
|
60
|
+
1. **Remove the gem** from your Gemfile
|
61
|
+
2. **Choose an alternative** from the options above
|
62
|
+
3. **Update your code** to use the new method
|
63
|
+
4. **Update your locale files** if necessary
|
64
|
+
|
65
|
+
## Need help?
|
66
|
+
|
67
|
+
If you need assistance with migration, please:
|
68
|
+
1. Check the README.md for detailed examples
|
69
|
+
2. Consider opening an issue for migration support
|
70
|
+
3. Review the alternative gem documentation
|
71
|
+
|
72
|
+
## Thank you
|
73
|
+
|
74
|
+
Thank you for using `enum-i18n`. We hope this gem served you well, and we encourage you to migrate to the more modern alternatives available today.
|
75
|
+
|
76
|
+
## Archive Date
|
77
|
+
**This gem will be archived on or after August 31, 2025.**
|
data/README.md
CHANGED
@@ -1,5 +1,46 @@
|
|
1
1
|
# EnumI18n
|
2
2
|
|
3
|
+
⚠️ **DEPRECATED: This gem is deprecated and will be archived soon.** ⚠️
|
4
|
+
|
5
|
+
## Why Deprecated?
|
6
|
+
|
7
|
+
This gem was created to provide I18n support for ActiveRecord enums, but Rails now has better built-in alternatives:
|
8
|
+
|
9
|
+
- **Rails 7.1+**: Use `human_attribute_name` with enum values
|
10
|
+
- **Alternative gems**: Consider using `enum_help` or `enumerize` which are more actively maintained
|
11
|
+
|
12
|
+
## Migration Guide
|
13
|
+
|
14
|
+
### Before (with enum-i18n):
|
15
|
+
```ruby
|
16
|
+
class User < ApplicationRecord
|
17
|
+
include EnumI18n
|
18
|
+
enum :status, [:active, :inactive]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Usage
|
22
|
+
@user.status_text # => "Active"
|
23
|
+
```
|
24
|
+
|
25
|
+
### After (Rails 7.1+):
|
26
|
+
```ruby
|
27
|
+
class User < ApplicationRecord
|
28
|
+
enum :status, [:active, :inactive]
|
29
|
+
end
|
30
|
+
|
31
|
+
# Usage
|
32
|
+
User.human_attribute_name("status.#{@user.status}") # => "Active"
|
33
|
+
```
|
34
|
+
|
35
|
+
### Alternative gems:
|
36
|
+
- **enum_help**: `gem 'enum_help'` - More actively maintained
|
37
|
+
- **enumerize**: `gem 'enumerize'` - Feature-rich enum management
|
38
|
+
|
39
|
+
## Archive Date
|
40
|
+
**This gem will be archived on or after August 31, 2025.**
|
41
|
+
|
42
|
+
---
|
43
|
+
|
3
44
|
Enum attributes with I18n and ActiveRecord support
|
4
45
|
|
5
46
|
## Installation
|
@@ -63,4 +104,6 @@ or can appoint i18n scope
|
|
63
104
|
|
64
105
|
## Contributing
|
65
106
|
|
66
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/amyroi/enum-i18n. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](
|
107
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/amyroi/enum-i18n. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://contributor-covenant.org) code of conduct.
|
108
|
+
|
109
|
+
For bug reports and issues, please use our [GitHub Issues](https://github.com/amyroi/enum-i18n/issues) page.
|
data/enum-i18n.gemspec
CHANGED
@@ -1,29 +1,33 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require 'enum-i18n/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
6
|
+
spec.name = 'enum-i18n'
|
8
7
|
spec.version = EnumI18n::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = ["atsuko.mori.200@gmail.com"]
|
8
|
+
spec.authors = ['amyroi']
|
11
9
|
|
12
|
-
spec.summary = 'Enum attributes with I18n and ActiveRecord support'
|
13
|
-
spec.description = 'Enum attributes with I18n and ActiveRecord support'
|
10
|
+
spec.summary = 'Enum attributes with I18n and ActiveRecord support (DEPRECATED)'
|
11
|
+
spec.description = 'Enum attributes with I18n and ActiveRecord support. DEPRECATED: This gem is deprecated and will be archived soon. Consider using Rails built-in human_attribute_name or alternative gems like enum_help.'
|
14
12
|
spec.homepage = 'https://github.com/amyroi/enum-i18n'
|
15
|
-
spec.license =
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.metadata = {
|
15
|
+
'deprecation_warning' => 'This gem is deprecated and will be archived on or after August 31, 2025. Consider migrating to Rails built-in alternatives or alternative gems.',
|
16
|
+
'github_repo' => 'https://github.com/amyroi/enum-i18n',
|
17
|
+
'bug_tracker_uri' => 'https://github.com/amyroi/enum-i18n/issues',
|
18
|
+
'source_code_uri' => 'https://github.com/amyroi/enum-i18n'
|
19
|
+
}
|
16
20
|
|
17
|
-
spec.files
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
22
|
f.match(%r{^(test|spec|features)/})
|
19
23
|
end
|
20
|
-
spec.bindir =
|
24
|
+
spec.bindir = 'exe'
|
21
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = [
|
26
|
+
spec.require_paths = ['lib']
|
23
27
|
|
24
|
-
spec.add_runtime_dependency
|
28
|
+
spec.add_runtime_dependency 'activerecord', '>= 4.1'
|
25
29
|
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
30
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
33
|
end
|
data/lib/enum-i18n/version.rb
CHANGED
data/lib/enum-i18n.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require 'enum-i18n/version'
|
2
|
+
|
3
|
+
# DEPRECATED: This gem is deprecated and will be archived on or after August 31, 2025.
|
4
|
+
# Consider using Rails built-in human_attribute_name or alternative gems like enum_help.
|
5
|
+
# See README.md for migration guide.
|
6
|
+
warn 'DEPRECATION WARNING: The enum-i18n gem is deprecated and will be archived on or after August 31, 2025. Consider migrating to Rails built-in alternatives or alternative gems.'
|
2
7
|
|
3
8
|
module EnumI18n
|
4
9
|
extend ActiveSupport::Concern
|
@@ -10,7 +15,7 @@ module EnumI18n
|
|
10
15
|
name = model_name.try(:i18n_key).to_s
|
11
16
|
defined_enums.each do |enum|
|
12
17
|
enum_column = enum.first
|
13
|
-
class_eval <<-METHOD
|
18
|
+
class_eval <<-METHOD, __FILE__, __LINE__ + 1
|
14
19
|
def #{enum_column}_text(scope=nil)
|
15
20
|
scope ||= 'activerecord.enum.#{name}.#{enum_column}'
|
16
21
|
I18n.t(#{enum_column}, scope: scope)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enum-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- amyroi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -66,9 +66,10 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
-
description: Enum attributes with I18n and ActiveRecord support
|
69
|
+
description: 'Enum attributes with I18n and ActiveRecord support. DEPRECATED: This
|
70
|
+
gem is deprecated and will be archived soon. Consider using Rails built-in human_attribute_name
|
71
|
+
or alternative gems like enum_help.'
|
70
72
|
email:
|
71
|
-
- atsuko.mori.200@gmail.com
|
72
73
|
executables: []
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
@@ -78,6 +79,7 @@ files:
|
|
78
79
|
- ".travis.yml"
|
79
80
|
- CHANGELOG.md
|
80
81
|
- CODE_OF_CONDUCT.md
|
82
|
+
- DEPRECATION.md
|
81
83
|
- Gemfile
|
82
84
|
- LICENSE.txt
|
83
85
|
- README.md
|
@@ -90,8 +92,13 @@ files:
|
|
90
92
|
homepage: https://github.com/amyroi/enum-i18n
|
91
93
|
licenses:
|
92
94
|
- MIT
|
93
|
-
metadata:
|
94
|
-
|
95
|
+
metadata:
|
96
|
+
deprecation_warning: This gem is deprecated and will be archived on or after August
|
97
|
+
31, 2025. Consider migrating to Rails built-in alternatives or alternative gems.
|
98
|
+
github_repo: https://github.com/amyroi/enum-i18n
|
99
|
+
bug_tracker_uri: https://github.com/amyroi/enum-i18n/issues
|
100
|
+
source_code_uri: https://github.com/amyroi/enum-i18n
|
101
|
+
post_install_message:
|
95
102
|
rdoc_options: []
|
96
103
|
require_paths:
|
97
104
|
- lib
|
@@ -106,9 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
113
|
- !ruby/object:Gem::Version
|
107
114
|
version: '0'
|
108
115
|
requirements: []
|
109
|
-
|
110
|
-
|
111
|
-
signing_key:
|
116
|
+
rubygems_version: 3.5.23
|
117
|
+
signing_key:
|
112
118
|
specification_version: 4
|
113
|
-
summary: Enum attributes with I18n and ActiveRecord support
|
119
|
+
summary: Enum attributes with I18n and ActiveRecord support (DEPRECATED)
|
114
120
|
test_files: []
|