aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-02-07 14:08:02 -0800
committerXavier Noria <fxn@hashref.com>2012-02-07 14:08:02 -0800
commit827b520bd1f946471105d9dd9593b9db56b0f6bc (patch)
treeef9b079ea4af43a655aedec75201623f96f2621b /railties/guides/source
parent55cc16f502399b69051e4ff5432569bbea45e9c0 (diff)
parenta470d796972749889a27e2070bbd95346bba45ea (diff)
downloadrails-827b520bd1f946471105d9dd9593b9db56b0f6bc.tar.gz
rails-827b520bd1f946471105d9dd9593b9db56b0f6bc.tar.bz2
rails-827b520bd1f946471105d9dd9593b9db56b0f6bc.zip
Merge pull request #4878 from vijaydev/ordinal-2072
PR #2072 with docs
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile17
1 files changed, 16 insertions, 1 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index c30902c237..61fdb5ccc6 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -1872,9 +1872,24 @@ The method +multiple_of?+ tests whether an integer is multiple of the argument:
NOTE: Defined in +active_support/core_ext/integer/multiple.rb+.
+h4. +ordinal+
+
+The method +ordinal+ returns the ordinal suffix string corresponding to the receiver integer:
+
+<ruby>
+1.ordinal # => "st"
+2.ordinal # => "nd"
+53.ordinal # => "rd"
+2009.ordinal # => "th"
+-21.ordinal # => "st"
+-134.ordinal # => "th"
+</ruby>
+
+NOTE: Defined in +active_support/core_ext/integer/inflections.rb+.
+
h4. +ordinalize+
-The method +ordinalize+ returns the ordinal string corresponding to the receiver integer:
+The method +ordinalize+ returns the ordinal string corresponding to the receiver integer. In comparison, note that the +ordinal+ method returns *only* the suffix string.
<ruby>
1.ordinalize # => "1st"