diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-14 12:18:51 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-14 12:18:51 +0000 |
commit | 6714b39a133bb8da1b4f6f485f35494ff8ad87ab (patch) | |
tree | ee2140a7a424f9e57a0887de0eea4ef43b6167cf /activesupport/lib/active_support/core_ext | |
parent | b78458284bf0c7d5158181fd4d7e0a507f77edca (diff) | |
download | rails-6714b39a133bb8da1b4f6f485f35494ff8ad87ab.tar.gz rails-6714b39a133bb8da1b4f6f485f35494ff8ad87ab.tar.bz2 rails-6714b39a133bb8da1b4f6f485f35494ff8ad87ab.zip |
Document Inflector.ordinalize and merge docs from String inflections. Closes #7023.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5924 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/integer/inflections.rb | 14 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/inflections.rb | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/integer/inflections.rb b/activesupport/lib/active_support/core_ext/integer/inflections.rb index 94721cfc7c..87b57e3adf 100644 --- a/activesupport/lib/active_support/core_ext/integer/inflections.rb +++ b/activesupport/lib/active_support/core_ext/integer/inflections.rb @@ -1,11 +1,17 @@ -require File.dirname(__FILE__) + '/../../inflector' unless defined? Inflector +require 'active_support/inflector' + module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Integer #:nodoc: module Inflections - # 1.ordinalize # => "1st" - # 3.ordinalize # => "3rd" - # 10.ordinalize # => "10th" + # Ordinalize turns a number into an ordinal string used to denote the + # position in an ordered sequence such as 1st, 2nd, 3rd, 4th. + # + # Examples + # 1.ordinalize # => "1st" + # 2.ordinalize # => "2nd" + # 1002.ordinalize # => "1002nd" + # 1003.ordinalize # => "1003rd" def ordinalize Inflector.ordinalize(self) end diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb index b4c9cab252..dec6c9f016 100644 --- a/activesupport/lib/active_support/core_ext/string/inflections.rb +++ b/activesupport/lib/active_support/core_ext/string/inflections.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../../inflector' unless defined? Inflector +require 'active_support/inflector' module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: |