module DateOutput

Constants

VERSION

Public Class Methods

full_date(date, options) click to toggle source
# File lib/date_output.rb, line 26
def self.full_date(date, options)
  set_options(options)
  date.strftime("%A #{date.day.ordinalize} %B %Y")
end
full_date_with_time(date, options) click to toggle source
# File lib/date_output.rb, line 6
def self.full_date_with_time(date, options)
  set_options(options)
  date.strftime("%A #{date.day.ordinalize} %B %Y %H:%M%P")
end
long_date_no_day(date, options) click to toggle source
# File lib/date_output.rb, line 36
def self.long_date_no_day(date, options)
  set_options(options)
  date.strftime("#{date.day.ordinalize} %B %Y")
end
long_date_no_day_with_time(date, options) click to toggle source
# File lib/date_output.rb, line 46
def self.long_date_no_day_with_time(date, options)
  set_options(options)
  date.strftime("#{date.day.ordinalize} %B %Y %H:%M%P")
end
numbered_date(date, options) click to toggle source
# File lib/date_output.rb, line 21
def self.numbered_date(date, options)
  set_options(options)
  date.strftime("%d#{@seperator}%m#{@seperator}%Y")
end
numbered_date_with_time(date, options) click to toggle source
# File lib/date_output.rb, line 16
def self.numbered_date_with_time(date, options)
  set_options(options)
  date.strftime("%d#{@seperator}%m#{@seperator}%Y %H:%M%P")
end
short_date(date, options) click to toggle source
# File lib/date_output.rb, line 31
def self.short_date(date, options)
  set_options(options)
  date.strftime("%a #{date.day.ordinalize} %b %y")
end
short_date_no_day(date, options) click to toggle source
# File lib/date_output.rb, line 41
def self.short_date_no_day(date, options)
  set_options(options)
  date.strftime("#{date.day.ordinalize} %b %y")
end
short_date_no_day_with_time(date, options) click to toggle source
# File lib/date_output.rb, line 51
def self.short_date_no_day_with_time(date, options)
  set_options(options)
  date.strftime("#{date.day.ordinalize} %b %y %H:%M%P")
end
short_date_with_time(date, options) click to toggle source
# File lib/date_output.rb, line 11
def self.short_date_with_time(date, options)
  set_options(options)
  date.strftime("%a #{date.day.ordinalize} %b %y %H:%M%P")
end

Private Class Methods

set_options(options) click to toggle source
# File lib/date_output.rb, line 57
def self.set_options(options)
  # options.each do |k,v|
  #   instance_variable_set("@#{k}",v)
  # end
  @seperator = options[:seperator] || "/"
end