Class: Integer

Inherits:
Object show all
Defined in:
lib/ruby_extensions.rb

Instance Method Summary collapse

Instance Method Details

#ordinalObject



59
60
61
# File 'lib/ruby_extensions.rb', line 59

def ordinal
  to_s + ([[nil, 'st','nd','rd'],[]][self / 10 == 1 && 1 || 0][self % 10] || 'th')
end