Module | Mongoid::Extensions::String::Inflections |
In: |
lib/mongoid/extensions/string/inflections.rb
|
This module contains convenience methods for string inflection and conversion.
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" |
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.