Skip to content

Commit

Permalink
Add XML comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytro-i committed May 7, 2015
1 parent 053ab63 commit ca96ffa
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Humanizer/InflectorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,41 @@ public string Apply(string word)
}
}

/// <summary>
/// Adds pluralization rule for irregular words
/// </summary>
/// <param name="singular">Regular expression for singular form</param>
/// <param name="plural">Plural form ending of irregular word</param>
public static void AddIrregular(string singular, string plural)
{
AddPlural("(" + singular[0] + ")" + singular.Substring(1) + "$", "$1" + plural.Substring(1));
AddSingular("(" + plural[0] + ")" + plural.Substring(1) + "$", "$1" + singular.Substring(1));
}

/// <summary>
/// Adds a word to the list of uncountable words
/// </summary>
/// <param name="word">Uncountable word to add</param>
public static void AddUncountable(string word)
{
Uncountables.Add(word.ToLower());
}

/// <summary>
/// Adds pluralization rule
/// </summary>
/// <param name="rule">Regular expression for singular form</param>
/// <param name="replacement">Plural form ending of the word</param>
public static void AddPlural(string rule, string replacement)
{
Plurals.Add(new Rule(rule, replacement));
}

/// <summary>
/// Adds singularization rule
/// </summary>
/// <param name="rule">Regular expression for plural form</param>
/// <param name="replacement">String to replace part or entirety of the word in singular form</param>
public static void AddSingular(string rule, string replacement)
{
Singulars.Add(new Rule(rule, replacement));
Expand Down

0 comments on commit ca96ffa

Please sign in to comment.