Method: Time#to_nice_s
- Defined in:
- lib/texmailer/drafts.rb
#to_nice_s(from = Time.now) ⇒ Object
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/texmailer/drafts.rb', line 320 def to_nice_s from=Time.now if year != from.year strftime "%b %Y" elsif month != from.month strftime "%b %e" else if is_the_same_day? from strftime("%l:%M%p").downcase # emulate %P (missing on ruby 1.8 darwin) elsif is_the_day_before? from "Yest." + nearest_hour.strftime("%l%p").downcase # emulate %P else strftime "%b %e" end end end |