Method: Date.find_beginning_of_week!

Defined in:
activesupport/lib/active_support/core_ext/date/calculations.rb

.find_beginning_of_week!(week_start) ⇒ Object

Returns week start day symbol (e.g. :monday), or raises an ArgumentError for invalid day symbol.

Raises:

  • (ArgumentError)

32
33
34
35
# File 'activesupport/lib/active_support/core_ext/date/calculations.rb', line 32

def find_beginning_of_week!(week_start)
  raise ArgumentError, "Invalid beginning of week: #{week_start}" unless ::Date::DAYS_INTO_WEEK.key?(week_start)
  week_start
end