Class: Pagy::Calendar::Quarter
- Inherits:
-
Pagy::Calendar
- Object
- Pagy
- Pagy::Calendar
- Pagy::Calendar::Quarter
- Defined in:
- lib/pagy/calendar/quarter.rb
Overview
Calendar quarter subclass
Constant Summary collapse
- DEFAULT =
rubocop:disable Style/MutableConstant
{ size: 4, # rubocop:disable Style/MutableConstant order: :asc, format: 'Q%q' }
Constants inherited from Pagy::Calendar
Constants inherited from Pagy
ElasticsearchRails, LABEL_TOKEN, Meilisearch, PAGE_TOKEN, Searchkick, VERSION
Instance Attribute Summary
Attributes inherited from Pagy::Calendar
Attributes inherited from Pagy
#count, #from, #in, #items, #last, #next, #offset, #page, #prev, #to, #vars
Instance Method Summary collapse
-
#label_for(page, opts = {}) ⇒ Object
The label for any page, with the substitution of the ‘%q’ token.
Methods inherited from Pagy::Calendar
Methods included from I18nExtra::CalendarOverride
Methods included from JSTools::CalendarOverride
Methods included from OverflowExtra::PagyOverride
Methods inherited from Pagy
#initialize, #label, root, #series
Methods included from SearchkickExtra::PagyExtension
Methods included from MeilisearchExtra::PagyExtension
Methods included from ElasticsearchRailsExtra::PagyAddOn
Methods included from GearboxExtra
#setup_items_var, #setup_last_var, #setup_offset_var
Methods included from JSTools::PagyAddOn
Constructor Details
This class inherits a constructor from Pagy::Calendar
Instance Method Details
#label_for(page, opts = {}) ⇒ Object
The label for any page, with the substitution of the ‘%q’ token
13 14 15 16 17 |
# File 'lib/pagy/calendar/quarter.rb', line 13 def label_for(page, opts = {}) starting_time = starting_time_for(page.to_i) # page could be a string opts[:format] = (opts[:format] || @vars[:format]).gsub('%q') { (starting_time.month / 3.0).ceil } localize(starting_time, opts) end |