Packagecom.memamsa.airdb
Classpublic class Inflector

Word utilities to help map class names to tables and fields.

The Inflector provides for transforming a ClassName into underscored, humanized or camel-cased forms and vice-versa. It also includes support for converting to and between singular and plural forms for common words.


Example
Some common examples
  Inflector.underscore("ActionScript"); // "action_script"
  Inflector.pluralize("Post");          // "Posts"
  

The default mapping of a model class to its table
  Inflector.underscore(Inflector.pluralize(className));
  

See also

DB.mapTable()


Protected Properties
 PropertyDefined by
  pluralRules : Array
[static]
Inflector
  singularRules : Array
[static]
Inflector
Public Methods
 MethodDefined by
  
camelize(word:String):String
[static] Camelizes an underscored phrase
Inflector
  
humanize(word:String, capitalize:Boolean = false):String
[static] Returns a the phrase as it would be read with spaces, optionally capitalizing the first character in each word
Inflector
  
lowerFirst(phrase:String):String
[static] Returns a phrase with only the first character lowercased
Inflector
  
lowerWords(phrase:String):String
[static] Returns a phrase with all the words in it not capitalized
Inflector
  
pluralize(word:String):String
[static] Returns the plural version of a word
Inflector
  
singularize(word:String):String
[static] Gives back the singular version of a plural word
Inflector
  
underscore(word:String):String
[static] Returns the underscore version of a phrase
Inflector
  
upperFirst(phrase:String):String
[static] Returns a phrase with only the first character capitalized
Inflector
  
upperWords(phrase:String):String
[static] Returns a phrase with all the words in it capitalized
Inflector
Property detail
pluralRulesproperty
protected static var pluralRules:Array
singularRulesproperty 
protected static var singularRules:Array
Method detail
camelize()method
public static function camelize(word:String):String

Camelizes an underscored phrase

Parameters
word:String

Returns
String
humanize()method 
public static function humanize(word:String, capitalize:Boolean = false):String

Returns a the phrase as it would be read with spaces, optionally capitalizing the first character in each word

Parameters
word:String
 
capitalize:Boolean (default = false)

Returns
String
lowerFirst()method 
public static function lowerFirst(phrase:String):String

Returns a phrase with only the first character lowercased

Parameters
phrase:String

Returns
String
lowerWords()method 
public static function lowerWords(phrase:String):String

Returns a phrase with all the words in it not capitalized

Parameters
phrase:String

Returns
String
pluralize()method 
public static function pluralize(word:String):String

Returns the plural version of a word

Parameters
word:String

Returns
String
singularize()method 
public static function singularize(word:String):String

Gives back the singular version of a plural word

Parameters
word:String

Returns
String
underscore()method 
public static function underscore(word:String):String

Returns the underscore version of a phrase

Parameters
word:String

Returns
String
upperFirst()method 
public static function upperFirst(phrase:String):String

Returns a phrase with only the first character capitalized

Parameters
phrase:String

Returns
String
upperWords()method 
public static function upperWords(phrase:String):String

Returns a phrase with all the words in it capitalized

Parameters
phrase:String

Returns
String