class ActiveSupport::Inflector::Inflections::Uncountables
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/active_support/inflector/inflections.rb, line 32 def initialize @regex_array = [] super end
Public Instance Methods
<<(*word)
click to toggle source
# File lib/active_support/inflector/inflections.rb, line 42 def <<(*word) add(word) end
add(words)
click to toggle source
# File lib/active_support/inflector/inflections.rb, line 46 def add(words) words = words.flatten.map(&:downcase) concat(words) @regex_array += words.map { |word| to_regex(word) } self end
delete(entry)
click to toggle source
Calls superclass method
# File lib/active_support/inflector/inflections.rb, line 37 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 53 def uncountable?(str) @regex_array.any? { |regex| regex.match? str } end
Private Instance Methods
to_regex(string)
click to toggle source
# File lib/active_support/inflector/inflections.rb, line 58 def to_regex(string) /\b#{::Regexp.escape(string)}\Z/i end