Module: DataBuilder::DateGeneration
- Included in:
- DataBuilder, Generation
- Defined in:
- lib/data_builder/generation_date.rb
Instance Method Summary collapse
- #day_of_week ⇒ Object (also: #db_day_of_week)
- #day_of_week_abbr ⇒ Object (also: #db_day_of_week_abbr)
- #month ⇒ Object (also: #db_month)
- #month_abbr ⇒ Object (also: #db_month_abbr)
- #today(format = '%D') ⇒ Object (also: #db_today)
- #tomorrow(format = '%D') ⇒ Object (also: #dn_tomorrow)
- #yesterday(format = '%D') ⇒ Object (also: #db_yesterday)
Instance Method Details
#day_of_week ⇒ Object Also known as: db_day_of_week
25 26 27 |
# File 'lib/data_builder/generation_date.rb', line 25 def day_of_week randomize(Date::DAYNAMES) end |
#day_of_week_abbr ⇒ Object Also known as: db_day_of_week_abbr
29 30 31 |
# File 'lib/data_builder/generation_date.rb', line 29 def day_of_week_abbr randomize(Date::ABBR_DAYNAMES) end |
#month ⇒ Object Also known as: db_month
17 18 19 |
# File 'lib/data_builder/generation_date.rb', line 17 def month randomize(Date::MONTHNAMES[1..-1]) end |
#month_abbr ⇒ Object Also known as: db_month_abbr
21 22 23 |
# File 'lib/data_builder/generation_date.rb', line 21 def month_abbr randomize(Date::ABBR_MONTHNAMES[1..-1]) end |
#today(format = '%D') ⇒ Object Also known as: db_today
3 4 5 |
# File 'lib/data_builder/generation_date.rb', line 3 def today(format = '%D') Date.today.strftime(format) end |
#tomorrow(format = '%D') ⇒ Object Also known as: dn_tomorrow
7 8 9 10 |
# File 'lib/data_builder/generation_date.rb', line 7 def tomorrow(format = '%D') tomorrow = Date.today + 1 tomorrow.strftime(format) end |
#yesterday(format = '%D') ⇒ Object Also known as: db_yesterday
12 13 14 15 |
# File 'lib/data_builder/generation_date.rb', line 12 def yesterday(format = '%D') yesterday = Date.today - 1 yesterday.strftime(format) end |