Method: Integrity::Helpers::PrettyOutput#strftime_with_ordinal
- Defined in:
- lib/integrity/helpers/pretty_output.rb
#strftime_with_ordinal(date_time, format_string) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/integrity/helpers/pretty_output.rb', line 33 def strftime_with_ordinal(date_time, format_string) ordinal = case date_time.day when 1, 21, 31 then "st" when 2, 22 then "nd" when 3, 23 then "rd" else "th" end date_time.strftime(format_string.gsub("%o", ordinal)) end |