From a470d796972749889a27e2070bbd95346bba45ea Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 4 Feb 2012 18:38:26 +0530 Subject: Document Integer#ordinal available in PR #2072. Also remove an unasserted line in the tests. --- .../source/active_support_core_extensions.textile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'railties/guides/source') 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: + + +1.ordinal # => "st" +2.ordinal # => "nd" +53.ordinal # => "rd" +2009.ordinal # => "th" +-21.ordinal # => "st" +-134.ordinal # => "th" + + +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. 1.ordinalize # => "1st" -- cgit v1.2.3