Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/rocker.rb

Overview

[ Extensions ]

Instance Method Summary collapse

Instance Method Details

#ordinalizeObject



477
478
479
480
481
482
483
484
# File 'lib/rocker.rb', line 477

def ordinalize
   n= self.to_s
   s= n[-2]=='1' ? 'th' :
	 n[-1]=='1' ? 'st' :
	 n[-1]=='2' ? 'nd' :
	 n[-1]=='3' ? 'rd' : 'th'
   n + s
end