module Ordinals

file: human_speakable.rb

Public Instance Methods

ordinal() click to toggle source
# File lib/human_speakable.rb, line 9
def ordinal
  self.to_s + ( (10...20).include?(self) ? 'th' : 
                      %w{ th st nd rd th th th th th th }[self % 10] )
end