Module: I18n::Locale::BeginningOfWeek::ClassMethods
- Defined in:
- lib/i18n/beginning_of_week.rb
Instance Method Summary collapse
-
#beginning_of_week(locale = I18n.locale) ⇒ Symbol
Get the beginning of week symbol based on the locale.
-
#in_beginning_of_week(locale = I18n.locale) ⇒ Object
Run the block in the context of the i18n beginning of the week.
Instance Method Details
#beginning_of_week(locale = I18n.locale) ⇒ Symbol
Get the beginning of week symbol based on the locale
35 36 37 |
# File 'lib/i18n/beginning_of_week.rb', line 35 def beginning_of_week(locale = I18n.locale) LOCALE_DAYS[locale] || Date.beginning_of_week end |
#in_beginning_of_week(locale = I18n.locale) ⇒ Object
Run the block in the context of the i18n beginning of the week
41 42 43 44 45 46 47 |
# File 'lib/i18n/beginning_of_week.rb', line 41 def in_beginning_of_week(locale = I18n.locale) original_beginning_of_week = Date.beginning_of_week Date.beginning_of_week = beginning_of_week(locale) yield ensure Date.beginning_of_week = original_beginning_of_week end |