Module: EnumHelp::I18n
- Defined in:
- lib/enum_help/i18n.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#enum(definitions) ⇒ Object
overwrite the enum method.
Class Method Details
.extended(receiver) ⇒ Object
31 32 33 34 35 |
# File 'lib/enum_help/i18n.rb', line 31 def self.extended(receiver) # receiver.class_eval do # # alias_method_chain :enum, :enum_help # end end |
Instance Method Details
#enum(definitions) ⇒ Object
overwrite the enum method
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/enum_help/i18n.rb', line 7 def enum(name = nil, values = nil, **) super(name, values, **) if name # For new syntax in Rails7 Helper.define_attr_i18n_method(self, name) Helper.define_collection_i18n_method(self, name) else definitions = .slice!(:_prefix, :_suffix, :_scopes, :_default) definitions.each do |name, _| Helper.define_attr_i18n_method(self, name) Helper.define_collection_i18n_method(self, name) end end end |