New in version 1.1.0.
Word transformation.
Transforms words from singular to plural, class names to table names, modularized class names to ones without, and class names to foreign keys.
Inflection is language specific and the default inflection handles English language inflection. You can access inflection handlers for other languages by importing the appropriate inflector. For example from miwa.inflection.sv import inflection to use Swedish inflection.
Author: | Rasmus Andersson http://hunch.se/ |
---|---|
var inflections: | |
locale-to-Inflection-object map | |
var inflection: | English inflection |
Language inflector.
Variable locales: | |
---|---|
languages this inflection handles | |
Variable plurals: | |
plural rules | |
Variable singulars: | |
singular rules | |
Variable uncountables: | |
list of uncountable words |
By default, camelize converts strings to UpperCamelCase. If the first_letter_uppercase argument is set to False, camelize produces lowerCamelCase.
camelize will also convert / to . which is useful for converting paths to namespaces
Return type: | unicode |
---|
Create a class name from a table name.
Return type: | unicode |
---|
Clears any loaded inflections.
Return type: | None |
---|
Removes the module part from the expression in the string
Return type: | unicode |
---|
Creates a foreign key name from a class name. +separate_class_name_and_id_with_underscore+ sets whether the method should put ‘_’ between the name and ‘id’.
Return type: | unicode |
---|
Capitalizes the first word and turns underscores into spaces and strips _id. Like titleize, this is meant for creating pretty output.
Return type: | unicode |
---|
Specifies a new irregular that applies to both pluralization and singularization at the same time.
Return type: | None |
---|
Ordinalize turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
Return type: | unicode |
---|
Specifies a new pluralization rule and its replacement.
Return type: | None |
---|
Returns the plural form of the word in the string.
Return type: | unicode |
---|
Specified a new regular inflection.
Parameters: |
|
---|---|
Return type: | None |
Specifies a new singularization rule and its replacement.
Return type: | None |
---|
The reverse of pluralize, returns the singular form of a word in a string.
Parameters: |
|
---|---|
Return type: | unicode |
Create the name of a table like Rails does for models to table names. This method uses the pluralize method on the last word in the string.
Return type: | unicode |
---|
Add uncountable words that shouldn’t be attempted inflected.
Parameters: |
|
---|---|
Return type: | None |
The reverse of camelize. Makes an underscored form from the expression in the string.
Changes ‘.’ to ‘/’ to convert namespaces to paths.
Return type: | unicode |
---|