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(word) ⇒ Object
- #underscore_and_pluralize(word) ⇒ Object
Constructor Details
#initialize ⇒ PluralCache
Returns a new instance of PluralCache.
4 5 6 |
# File 'lib/paperclip/interpolations/plural_cache.rb', line 4 def initialize @cache = {} end |
Instance Method Details
#pluralize(word) ⇒ Object
8 9 10 |
# File 'lib/paperclip/interpolations/plural_cache.rb', line 8 def pluralize(word) @cache[word] ||= word.pluralize end |
#underscore_and_pluralize(word) ⇒ Object
12 13 14 |
# File 'lib/paperclip/interpolations/plural_cache.rb', line 12 def underscore_and_pluralize(word) @cache[word] ||= word.underscore.pluralize end |