Class: Paperclip::Interpolations::PluralCache

Inherits:
Object
  • Object
show all
Defined in:
lib/paperclip/interpolations/plural_cache.rb

Instance Method Summary collapse

Constructor Details

#initializePluralCache

Returns a new instance of PluralCache.



4
5
6
7
# File 'lib/paperclip/interpolations/plural_cache.rb', line 4

def initialize
  @symbol_cache = {}.compare_by_identity
  @klass_cache = {}.compare_by_identity
end

Instance Method Details

#pluralize_symbol(symbol) ⇒ Object



9
10
11
# File 'lib/paperclip/interpolations/plural_cache.rb', line 9

def pluralize_symbol(symbol)
  @symbol_cache[symbol] ||= symbol.to_s.downcase.pluralize
end

#underscore_and_pluralize_class(klass) ⇒ Object



13
14
15
# File 'lib/paperclip/interpolations/plural_cache.rb', line 13

def underscore_and_pluralize_class(klass)
  @klass_cache[klass] ||= klass.name.underscore.pluralize
end