module FigMagic::DateTranslation

Public Instance Methods

day_of_week() click to toggle source

return a day of the week

# File lib/fig_magic/date_translation.rb, line 63
def day_of_week
  randomize(Date::DAYNAMES)
end
Also aliased as: dm_day_of_week
day_of_week_abbr() click to toggle source
# File lib/fig_magic/date_translation.rb, line 68
def day_of_week_abbr
  randomize(Date::ABBR_DAYNAMES)
end
Also aliased as: dm_day_of_week_abbr
dm_day_of_week()
Alias for: day_of_week
dm_day_of_week_abbr()
Alias for: day_of_week_abbr
dm_month()
Alias for: month
dm_month_abbr()
Alias for: month_abbr
dm_today(format = '%D')
Alias for: today
dm_tomorrow(format = '%D')
Alias for: tomorrow
dm_yesterday(format = '%D')
Alias for: yesterday
month() click to toggle source

return a month

# File lib/fig_magic/date_translation.rb, line 47
def month
  randomize(Date::MONTHNAMES[1..-1])
end
Also aliased as: dm_month
month_abbr() click to toggle source

return a month abbreviation

# File lib/fig_magic/date_translation.rb, line 55
def month_abbr
  randomize(Date::ABBR_MONTHNAMES[1..-1])
end
Also aliased as: dm_month_abbr
today(format = '%D') click to toggle source

return today’s date

@param String the format to use for the date. Default is %D

See ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#method-i-strftime for details of the formats

# File lib/fig_magic/date_translation.rb, line 11
def today(format = '%D')
  Date.today.strftime(format)
end
Also aliased as: dm_today
tomorrow(format = '%D') click to toggle source

return tomorrow’s date

@param String the format to use for the date. Default is %D

See ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#method-i-strftime for details of the formats

# File lib/fig_magic/date_translation.rb, line 24
def tomorrow(format = '%D')
  tomorrow = Date.today + 1
  tomorrow.strftime(format)
end
Also aliased as: dm_tomorrow
yesterday(format = '%D') click to toggle source

return yesterday’s date

@param String the format to use for the date. Default is %D

See ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#method-i-strftime for details of the formats

# File lib/fig_magic/date_translation.rb, line 38
def yesterday(format = '%D')
  yesterday = Date.today - 1
  yesterday.strftime(format)
end
Also aliased as: dm_yesterday