module SchemaRD::Utils::Singularizer

Constants

NO_SINGULAR_WORDS
SINGULAR_RULES

Public Instance Methods

singularize() click to toggle source
# File lib/schemard/utils/singularizer.rb, line 3
def singularize
  return self if NO_SINGULAR_WORDS.include?(self)

  found = SINGULAR_RULES.find{|regexp, _| self =~ regexp }
  found ? self.gsub(found[0], found[1]) : self
end