Sha256: 9f416e7035e7284535d0dd6c8181ff07ff8b98582ea7f2f5387b2eab6fc940cf
Contents?: true
Size: 582 Bytes
Versions: 1
Compression:
Stored size: 582 Bytes
Contents
# A couple of Ruby extensions class Date # Returns the date formatted with the format defined in Serious.date_format # and extended with the %o flag for ordinal day names. def formatted strftime(Serious.date_format.gsub("%o", day.ordinal)) end end class Fixnum # Taken from toto def ordinal # 1 => 1st # 2 => 2nd # 3 => 3rd # ... case self % 100 when 11..13; "#{self}th" else case self % 10 when 1; "#{self}st" when 2; "#{self}nd" when 3; "#{self}rd" else "#{self}th" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
serious-0.2.1 | lib/ruby_ext.rb |