Files
grecia/config/initializers/i18n_pluralize.rb
Javi Martín d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +02:00

19 lines
547 B
Ruby

### From official I18n::Backend::Base
### https://github.com/svenfuchs/i18n/blob/f35b839693c5ecc7ea0ff0f57c5cbf6db1dd73f9/lib/i18n/backend/base.rb#L155
### Just changed one line to return `count` instead of raising the exception `InvalidPluralizationData`
module I18n
module Backend
module Base
def pluralize(locale, entry, count)
return entry unless entry.is_a?(Hash) && count
key = pluralization_key(entry, count)
return "#{count}" unless entry.has_key?(key)
entry[key]
end
end
end
end