Class: Fixnum

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

Instance Method Summary collapse

Instance Method Details

#ordinalizeObject



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/rtype/core_ext.rb', line 64

def ordinalize
    if (11..13).include?(self % 100)
		"#{self}th"
    else
		case self % 10
		when 1; "#{self}st"
		when 2; "#{self}nd"
		when 3; "#{self}rd"
		else "#{self}th"
		end
    end
end