#

API Docs for: v3.8.1
Show: Inherited Protected Private Deprecated

# Ember.Inflector Class

Defined in: `node_modules/ember-inflector/addon/lib/system/inflector.js:30`
Module: ember-data

Inflector.Ember provides a mechanism for supplying inflection rules for your application. Ember includes a default set of inflection rules, and provides an API for providing additional rules.

Examples:

Creating an inflector with no rules.

    var inflector = new Ember.Inflector();

Creating an inflector with the default ember ruleset.

    var inflector = new Ember.Inflector(Ember.Inflector.defaultRules);

    inflector.pluralize('cow'); //=> 'kine'
    inflector.singularize('kine'); //=> 'cow'

Creating an inflector and adding rules later.

    var inflector = Ember.Inflector.inflector;

    inflector.pluralize('advice'); // => 'advices'
    inflector.uncountable('advice');
    inflector.pluralize('advice'); // => 'advice'

    inflector.pluralize('formula'); // => 'formulas'
    inflector.irregular('formula', 'formulae');
    inflector.pluralize('formula'); // => 'formulae'

    // you would not need to add these as they are the default rules
    inflector.plural(/$/, 's');
    inflector.singular(/s$/i, '');

Creating an inflector with a nondefault ruleset.

    var rules = {
      plurals:  [
        [ /$/, 's' ]
      ],
      singular: [
        [ /\s$/, '' ]
      ],
      irregularPairs: [
        [ 'cow', 'kine' ]
      ],
      uncountable: [ 'fish' ]
    };

    var inflector = new Ember.Inflector(rules);

- Index
- Methods

## Item Index

### Methods

- disableCache;
- enableCache
- inflect
- irregular
- plural
- pluralize
- purgedCache
- singular
- singularize
- uncountable

## Methods

### `disableCache;`

() public

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:157`

### `enableCache`

() public

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:123`

### `inflect`

(

- `word`
- `typeRules`
- `irregular`

)
protected

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:245`

#### Parameters:

- `word` String
- `typeRules` Object
- `irregular` Object

### `irregular`

(

- `singular`
- `plural`

)

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:204`

#### Parameters:

- `singular` String
- `plural` String

### `plural`

(

- `regex`
- `string`

)

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:175`

#### Parameters:

- `regex` RegExp
- `string` String

### `pluralize`

(

- `word`

)

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:214`

#### Parameters:

- `word` String

### `purgedCache`

() public

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:146`

### `singular`

(

- `regex`
- `string`

)

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:185`

#### Parameters:

- `regex` RegExp
- `string` String

### `singularize`

(

- `word`

)

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:233`

#### Parameters:

- `word` String

### `uncountable`

(

- `regex`

)

Defined in `node_modules/ember-inflector/addon/lib/system/inflector.js:195`

#### Parameters:

- `regex` String