Sha256: 6da18a14c3005013025a212fe4bf1939c7f125bf67505652cad74bcc0090ef1d
Contents?: true
Size: 1.17 KB
Versions: 17
Compression:
Stored size: 1.17 KB
Contents
module ApplicationHelper # Long date format # # @param date [Date] the date object # @return day date month year - hour:minutes AM/PM def long_date(date) date.strftime("%A %d %B %Y - %H:%M %p") rescue 'unknown' end # Medium date format # # @param date [Date] the date object # @return month/date/year at hour:minutes AM/PM def medium_date(date) date.strftime("%m/%d/%Y at %H:%M %p") rescue 'unknown' end # Another style of medium date format # # @param date [Date] the date object # @return day/MONTH/YEAR # Produces -> 18 October 2015 def medium_date2(date) date.strftime("%d %B %Y") rescue 'unknown' end # Short date format # # @param date [Date] the date object # @return year-month-date def short_date(date) date.strftime("%Y-%m-%d") rescue 'unknown' end # US date format # # @param date [Date] the date object # @return year-month-date def us_date(date) date.strftime("%m/%d/%Y at %H:%M %p") rescue 'unknown' end def present(object, klass = nil) klass ||= "#{object.class}Presenter".constantize presenter = klass.new(object, self) yield presenter if block_given? presenter end end
Version data entries
17 entries across 17 versions & 1 rubygems