aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/fixnum/inflections.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-17 10:02:23 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-17 10:02:23 +0000
commit33cf8f162e1ea2c10e6ba253b333f256802c3250 (patch)
tree2c4fca502c8afe64ead7fa9bc7849dab4f1fdc0d /activesupport/lib/active_support/core_ext/fixnum/inflections.rb
parent80cfa76f7de298b5eb3e2b971766c676e9e147b1 (diff)
downloadrails-33cf8f162e1ea2c10e6ba253b333f256802c3250.tar.gz
rails-33cf8f162e1ea2c10e6ba253b333f256802c3250.tar.bz2
rails-33cf8f162e1ea2c10e6ba253b333f256802c3250.zip
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
Diffstat (limited to 'activesupport/lib/active_support/core_ext/fixnum/inflections.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/fixnum/inflections.rb15
1 files changed, 15 insertions, 0 deletions
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