class Period::Quarter

@author Lucas Billaudot <billau_l@modulotech.fr> @note One of the StandardPeriod defined in the gem

Public Instance Methods

i18n() { |from, to| ... } click to toggle source
# File lib/period/quarter.rb, line 32
def i18n(&block)
  return yield(from, to) if block.present?

  I18n.t(:default_format,
         scope:       i18n_scope,
         quarter_nb:  quarter_nb,
         year:        from.year)
end
quarter_nb() click to toggle source
# File lib/period/quarter.rb, line 24
def quarter_nb
  @quarter_nb ||= (from.month / 3.0).ceil
end
strftime(format) click to toggle source
# File lib/period/quarter.rb, line 19
def strftime(format)
  format = format.gsub(':quarter', quarter_nb.to_s)
  from.strftime(format)
end
to_s() click to toggle source
# File lib/period/quarter.rb, line 28
def to_s
  i18n
end