Module: EnumHelp::I18n

Defined in:
lib/enum_help/i18n.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(receiver) ⇒ Object



28
29
30
31
32
# File 'lib/enum_help/i18n.rb', line 28

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
# File 'lib/enum_help/i18n.rb', line 7

def enum(name = nil, values = nil, **options)
  super(name, values, **options)

  definitions = options.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