From 33cf8f162e1ea2c10e6ba253b333f256802c3250 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 17 Jul 2005 10:02:23 +0000 Subject: Added Fixnum#ordinalize to turn 1.ordinalize to "1st", 3.ordinalize to "3rd", and 10.ordinalize to "10th" and so on #1724 [paul@cnt.org] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1852 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_support/core_ext/fixnum/inflections.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 activesupport/lib/active_support/core_ext/fixnum/inflections.rb (limited to 'activesupport/lib/active_support/core_ext/fixnum/inflections.rb') diff --git a/activesupport/lib/active_support/core_ext/fixnum/inflections.rb b/activesupport/lib/active_support/core_ext/fixnum/inflections.rb new file mode 100644 index 0000000000..13c4f1130a --- /dev/null +++ b/activesupport/lib/active_support/core_ext/fixnum/inflections.rb @@ -0,0 +1,15 @@ +require File.dirname(__FILE__) + '/../../inflector' +module ActiveSupport #:nodoc: + module CoreExtensions #:nodoc: + module Fixnum #:nodoc: + module Inflections + # 1.ordinalize # => "1st" + # 3.ordinalize # => "3rd" + # 10.ordinalize # => "10th" + def ordinalize + Inflector.ordinalize(self) + end + end + end + end +end -- cgit v1.2.3