Class: ActivePeriod::Day
Instance Method Summary
collapse
#year
#quarter
#month
#week
#+, #-, #_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, #|
#holidays
Methods included from Comparable
#<=>, #clamp_on, #include?
Methods inherited from Range
#to_period
Instance Method Details
#holiday? ⇒ Boolean
33
34
35
36
|
# File 'lib/active_period/day.rb', line 33
def holiday?(...)
raise I18n.t(:gem_require, scope: %i[active_period holiday_period]) unless Object.const_defined?('Holidays')
holidays(...).first.present?
end
|
#i18n(&block) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/active_period/day.rb', line 22
def i18n(&block)
return yield(from, to) if block.present?
I18n.t(:default_format,
scope: i18n_scope,
wday: I18n.l(from, format: '%A').capitalize,
day: from.day,
month: I18n.l(from, format: '%B').capitalize,
year: from.year)
end
|
#strftime(format) ⇒ Object
14
15
16
|
# File 'lib/active_period/day.rb', line 14
def strftime(format)
from.strftime(format)
end
|
#to_s(format: '%d/%m/%Y') ⇒ Object
18
19
20
|
# File 'lib/active_period/day.rb', line 18
def to_s(format: '%d/%m/%Y')
strftime(format)
end
|