Module Mongoid::Extensions::String::Inflections
In: lib/mongoid/extensions/string/inflections.rb

This module contains convenience methods for string inflection and conversion.

Methods

Constants

CHAR_CONV = { " " => "-", "!" => "-excl-", "\"" => "-dblquo-", "#" => "-hash-", "$" => "-dol-", "%" => "-perc-", "&" => "-and-", "'" => "-quo-", "(" => "-oparen-", ")" => "-cparen-", "*" => "-astx-", "+" => "-plus-", "," => "-comma-", "-" => "-", "." => "-period-", "/" => "-fwdslsh-", ":" => "-colon-", ";" => "-semicol-", "<" => "-lt-", "=" => "-eq-", ">" => "-gt-", "?" => "-ques-", "@" => "-at-", "[" => "-obrck-", "\\" => "-bckslsh-", "]" => "-clbrck-", "^" => "-carat-", "_" => "-undscr-", "`" => "-bcktick-", "{" => "-ocurly-", "|" => "-pipe-", "}" => "-clcurly-", "~" => "-tilde-"   Represents how special characters will get converted when creating a composite key that should be unique and part of a url.
REVERSALS = { "asc" => "desc", "ascending" => "descending", "desc" => "asc", "descending" => "ascending"

Public Instance methods

Convert the string to a collection friendly name.

@example Collectionize the string.

  "namespace/model".collectionize

@return [ String ] The string in collection friendly form.

Convert this string to a key friendly string.

@example Convert to key.

  "testing".identify

@return [ String ] The key friendly string.

Get the inverted sorting option.

@example Get the inverted option.

  "asc".invert

@return [ String ] The string inverted.

Get the string as a getter string.

@example Get the reader/getter

  "model=".reader

@return [ String ] The string stripped of "=".

Is this string a writer?

@example Is the string a setter method?

  "model=".writer?

@return [ true, false ] If the string contains "=".

[Validate]