class Pagy::Calendar

def setup_unit_vars

Base class method for the setup of the unit variables (subclasses must implement it and call super)
def setup_unit_vars
  raise VariableError.new(self, :format, 'to be a strftime format', @vars[:format]) unless @vars[:format].is_a?(String)
  raise VariableError.new(self, :order, 'to be in [:asc, :desc]', @order) \
        unless %i[asc desc].include?(@order = @vars[:order])
  @starting, @ending = @vars[:period]
  raise VariableError.new(self, :period, 'to be a an Array of min and max TimeWithZone instances', @vars[:period]) \
        unless @starting.is_a?(ActiveSupport::TimeWithZone) \
            && @ending.is_a?(ActiveSupport::TimeWithZone) && @starting <= @ending
end