Created
March 14, 2013 03:13
-
-
Save jakeboxer/5158541 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Public: Same as Rails' ActionView::Helpers::TextHelper#pluralize, but | |
| # doesn't include the number in the result. | |
| # | |
| # Example: | |
| # pluralize(2, 'commit') # 2 commits | |
| # pluralize_without_number(2, 'commit') # commits | |
| # | |
| # count - Number to use to determine whether or not to pluralize | |
| # singular - How the word should look when singular | |
| # plural - How the word should look when plural. If nothing is supplied, the | |
| # the Inflector will be used to determine the plural form. | |
| # | |
| # Returns a string. | |
| def pluralize_without_number(count, singular, plural = nil) | |
| pluralize(count, singular, plural).split[1..-1].join(' ') | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment