lib/enum_help/i18n.rb in enum_help-0.0.10 vs lib/enum_help/i18n.rb in enum_help-0.0.11

- old
+ new

@@ -39,17 +39,13 @@ def self.define_collection_i18n_method(klass, attr_name) collection_method_name = "#{attr_name.to_s.pluralize}" collection_i18n_method_name = "#{collection_method_name}_i18n" klass.instance_eval <<-METHOD, __FILE__, __LINE__ - def #{collection_i18n_method_name}(*args) - options = args.extract_options! - collection = args[0] || send(:#{collection_method_name}) - collection.except! options[:except] if options[:except] - - collection.map do |label, value| - [::EnumHelp::Helper.translate_enum_label(self, :#{attr_name}, label), value] - end.to_h + def #{collection_i18n_method_name} + #{collection_method_name}.collect do |label, _| + [label, ::EnumHelp::Helper.translate_enum_label(self, :#{attr_name}, label)] + end.to_h.with_indifferent_access end METHOD end def self.translate_enum_label(klass, attr_name, enum_label)