Class: ActivePeriod::Week
- Inherits:
-
StandardPeriod
- Object
- Range
- Period
- StandardPeriod
- ActivePeriod::Week
- Includes:
- BelongsTo::Month, BelongsTo::Quarter, BelongsTo::Year, HasMany::Days
- Defined in:
- lib/active_period/week.rb
Overview
Note:
One of the StandardPeriod defined in the gem
Instance Method Summary collapse
- #i18n(&block) ⇒ Object
- #include_date ⇒ Object
- #strftime(format) ⇒ Object
- #to_s(format: '%V - %G') ⇒ Object
Methods included from BelongsTo::Year
Methods included from BelongsTo::Quarter
Methods included from BelongsTo::Month
Methods included from HasMany::Days
Methods inherited from StandardPeriod
#+, #-, #_period, _period, #i18n_scope, #initialize, #next, #prev, #to_i
Methods inherited from Period
#&, #+, #-, #==, #===, #beginless?, #boundless?, #calculated_begin, #calculated_end, #endless?, #infinite?, #initialize, #next, #prev, #to_i, #|
Methods included from HasMany::Holidays
Methods included from Comparable
Methods inherited from Range
Constructor Details
This class inherits a constructor from ActivePeriod::StandardPeriod
Instance Method Details
#i18n(&block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/active_period/week.rb', line 28 def i18n(&block) return yield(from, to) if block.present? I18n.t(:default_format, scope: i18n_scope, week: strftime('%V'), year: strftime('%G')) end |
#include_date ⇒ Object
37 38 39 |
# File 'lib/active_period/week.rb', line 37 def include_date from + 3.days end |
#strftime(format) ⇒ Object
20 21 22 |
# File 'lib/active_period/week.rb', line 20 def strftime(format) from.strftime(format) end |
#to_s(format: '%V - %G') ⇒ Object
24 25 26 |
# File 'lib/active_period/week.rb', line 24 def to_s(format: '%V - %G') strftime(format) end |