diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-05-08 23:48:15 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-05-08 23:48:15 +0530 |
commit | 91c18554f6f54ae2d4cb7e945d830b75aa0c3b18 (patch) | |
tree | a0300719abdf225ec4c57f1fc90f9e7e1244f45f | |
parent | a8daea4b85b2709600d5e894b7380149b0854b53 (diff) | |
download | rails-91c18554f6f54ae2d4cb7e945d830b75aa0c3b18.tar.gz rails-91c18554f6f54ae2d4cb7e945d830b75aa0c3b18.tar.bz2 rails-91c18554f6f54ae2d4cb7e945d830b75aa0c3b18.zip |
adds code examples for negative ordinalize
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index dd2beef89d..a2c4f7bfda 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -135,6 +135,8 @@ module ActiveSupport # ordinalize(2) # => "2nd" # ordinalize(1002) # => "1002nd" # ordinalize(1003) # => "1003rd" + # ordinalize(-11) # => "-11th" + # ordinalize(-1021) # => "-1021st" def ordinalize(number) if (11..13).include?(number.to_i.abs % 100) "#{number}th" @@ -148,4 +150,4 @@ module ActiveSupport end end end -end
\ No newline at end of file +end |