class ActiveSupport::Inflector::Inflections::Uncountables
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/active_support/inflector/inflections.rb, line 31 def initialize @regex_array = [] super end
Public Instance Methods
<<(*word)
click to toggle source
# File lib/active_support/inflector/inflections.rb, line 41 def <<(*word) add(word) end
add(words)
click to toggle source
# File lib/active_support/inflector/inflections.rb, line 45 def add(words) self.concat(words.flatten.map(&:downcase)) @regex_array += self.map {|word| to_regex(word) } self end
delete(entry)
click to toggle source
Calls superclass method
# File lib/active_support/inflector/inflections.rb, line 36 def delete(entry) super entry @regex_array.delete(to_regex(entry)) end
uncountable?(str)
click to toggle source
# File lib/active_support/inflector/inflections.rb, line 51 def uncountable?(str) @regex_array.any? { |regex| regex === str } end
Private Instance Methods
to_regex(string)
click to toggle source
# File lib/active_support/inflector/inflections.rb, line 56 def to_regex(string) /\b#{::Regexp.escape(string)}\Z/i end