Sha256: eac6b25c47ffb4e54ae3df0507b22f12f3addb8317bd463f7befef323a92235a
Contents?: true
Size: 264 Bytes
Versions: 29
Compression:
Stored size: 264 Bytes
Contents
# Add ordinal method to Numeric class class Numeric def ordinal cardinal = self.to_i.abs if (10...20).include?(cardinal) then cardinal.to_s << 'th' else cardinal.to_s << %w{th st nd rd th th th th th th}[cardinal % 10] end end end
Version data entries
29 entries across 29 versions & 1 rubygems