class Time Redwood::HookManager.register "time-to-nice-string", < self, :from => from) || default_to_nice_s(from) end def default_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 end