Module: Mongoid::Extensions::String::Inflections

Included in:
String
Defined in:
lib/mongoid/extensions/string/inflections.rb

Overview

:nodoc:

Constant Summary collapse

REVERSALS =
{
  "asc" => "desc",
  "ascending" => "descending",
  "desc" => "asc",
  "descending" => "ascending"
}

Instance Method Summary collapse

Instance Method Details

#invertObject



14
15
16
# File 'lib/mongoid/extensions/string/inflections.rb', line 14

def invert
  REVERSALS[self]
end

#plural?Boolean

Returns:



22
23
24
# File 'lib/mongoid/extensions/string/inflections.rb', line 22

def plural?
  pluralize == self
end

#singular?Boolean

Returns:



18
19
20
# File 'lib/mongoid/extensions/string/inflections.rb', line 18

def singular?
  singularize == self
end