Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/plural.rb

Instance Method Summary collapse

Instance Method Details

#pluralObject



53
54
55
56
57
58
59
60
61
62
# File 'lib/plural.rb', line 53

def plural
  result = self.dup

  if self.empty? || Plural.uncountables.any? { |i| result =~ /\b#{i}\Z/i }
    result
  else
    Plural.rules.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
    result
  end
end