Class: ReeDate::DaysToWeekStart
- Inherits:
-
Object
- Object
- ReeDate::DaysToWeekStart
- Includes:
- Ree::FnDSL
- Defined in:
- lib/ree_lib/packages/ree_date/package/ree_date/functions/days_to_week_start.rb
Instance Method Summary collapse
Instance Method Details
#call(date = nil, start_week_day) ⇒ Object
16 17 18 19 20 |
# File 'lib/ree_lib/packages/ree_date/package/ree_date/functions/days_to_week_start.rb', line 16 def call(date = nil, start_week_day) date = date || today start_day_number = DAYS_INTO_WEEK.fetch(start_week_day) (date.wday - start_day_number) % 7 end |