Class: ActivePeriod::Month
- Inherits:
-
StandardPeriod
- Object
- Range
- Period
- StandardPeriod
- ActivePeriod::Month
- Includes:
- BelongsTo::Quarter, BelongsTo::Year, HasMany::Days, HasMany::Weeks
- Defined in:
- lib/active_period/month.rb
Instance Method Summary collapse
Methods included from BelongsTo::Year
Methods included from BelongsTo::Quarter
Methods included from HasMany::Weeks
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
27 28 29 30 31 32 33 34 |
# File 'lib/active_period/month.rb', line 27 def i18n(&block) return yield(from, to) if block.present? I18n.t(:default_format, scope: i18n_scope, month: I18n.l(from, format: '%B').capitalize, year: from.year) end |
#strftime(format) ⇒ Object
19 20 21 |
# File 'lib/active_period/month.rb', line 19 def strftime(format) from.strftime(format) end |
#to_s(format: '%m/%Y') ⇒ Object
23 24 25 |
# File 'lib/active_period/month.rb', line 23 def to_s(format: '%m/%Y') strftime(format) end |