Class: Paperclip::Interpolations::PluralCache
- Inherits:
-
Object
- Object
- Paperclip::Interpolations::PluralCache
- Defined in:
- lib/paperclip/interpolations/plural_cache.rb
Instance Method Summary collapse
-
#initialize ⇒ PluralCache
constructor
A new instance of PluralCache.
- #pluralize_symbol(symbol) ⇒ Object
- #underscore_and_pluralize_class(klass) ⇒ Object
Constructor Details
#initialize ⇒ PluralCache
Returns a new instance of PluralCache.
6 7 8 9 |
# File 'lib/paperclip/interpolations/plural_cache.rb', line 6 def initialize @symbol_cache = {}.compare_by_identity @klass_cache = {}.compare_by_identity end |
Instance Method Details
#pluralize_symbol(symbol) ⇒ Object
11 12 13 |
# File 'lib/paperclip/interpolations/plural_cache.rb', line 11 def pluralize_symbol(symbol) @symbol_cache[symbol] ||= symbol.to_s.downcase.pluralize end |
#underscore_and_pluralize_class(klass) ⇒ Object
15 16 17 |
# File 'lib/paperclip/interpolations/plural_cache.rb', line 15 def underscore_and_pluralize_class(klass) @klass_cache[klass] ||= klass.name.underscore.pluralize end |