Sha256: e585f400f943523f4e94031df236bd15f503825ccf693ab4952be99f4805573f

Contents?: true

Size: 870 Bytes

Versions: 24

Compression:

Stored size: 870 Bytes

Contents

class Fixnum
  
  # todo: complete
  def human_ordinalize(map={})
    map.key?(self) ? map[self] : (begin
      if self < -1
        "#{(-self).human_ordinalize} to last"
      else
        case self
        when -1;  "last"
        when 1;   "first"
        when 2;   "second"
        when 3;   "third"
        when 4;   "fourth"
        when 5;   "fifth"
        when 6;   "sixth"
        when 7;   "seventh"
        when 8;   "eighth"
        when 9;   "ninth"
        when 10;  "tenth"
        when 11;  "eleventh"
        when 12;  "twelfth"
        when 13;  "thirteenth"
        when 14;  "fourteenth"
        when 15;  "fifteenth"
        when 16;  "sixteenth"
        when 17;  "seventeeth"
        when 18;  "eighteenth"
        when 19;  "nineteenth"
        when 20;  "twentieth"
        else;     self.ordinalize
        end
      end
    end)
  end
  
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
hiccup-0.5.14 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.13 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.12 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.11 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.10 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.9 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.8 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.7 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.6 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.5 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.4 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.3 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.2 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.1 lib/hiccup/core_ext/fixnum.rb
hiccup-0.5.0 lib/hiccup/core_ext/fixnum.rb
hiccup-0.4.5 lib/hiccup/core_ext/fixnum.rb
hiccup-0.4.4 lib/hiccup/core_ext/fixnum.rb
hiccup-0.4.3 lib/hiccup/core_ext/fixnum.rb
hiccup-0.4.2 lib/hiccup/core_ext/fixnum.rb
hiccup-0.4.1 lib/hiccup/core_ext/fixnum.rb