Sha256: 30eba5a67c740eae93402b672f99426185dc94e8ffcba5adad00b142ceb37f8e

Contents?: true

Size: 293 Bytes

Versions: 2

Compression:

Stored size: 293 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubype-0.3.1 lib/rubype/ordinalize.rb
rubype-0.3.0 lib/rubype/ordinalize.rb