Sha256: cf46546cca3cf6008bac7d72b1185d80a684bac094aa78f2ed2bc86a7c66423b

Contents?: true

Size: 229 Bytes

Versions: 2

Compression:

Stored size: 229 Bytes

Contents

# Borrowed from ActiveSupport::Inflector
def ordinal(number)
  if (11..13).include?(number % 100)
    "th"
  else
    case number % 10
      when 1; "st"
      when 2; "nd"
      when 3; "rd"
      else    "th"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubype-0.2.6 lib/rubype/ordinal.rb
rubype-0.2.5 lib/rubype/ordinal.rb