Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Adds ordinalize i.e. th,st,rd to a number for use in date string outputs

View fixnum_ordinalize.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class Fixnum
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
end
Something went wrong with that request. Please try again.