Module: Useful::RubyExtensions::Integer::FromActivesupport
- Defined in:
- lib/useful/ruby_extensions/integer.rb
Instance Method Summary collapse
Instance Method Details
#ordinalize ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/useful/ruby_extensions/integer.rb', line 43 def ordinalize if (11..13).include?(self.to_i % 100) "#{self}th" else case self.to_i % 10 when 1; "#{self}st" when 2; "#{self}nd" when 3; "#{self}rd" else "#{self}th" end end end |