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
{ order: :asc, # rubocop:disable Style/MutableConstant format: '%Y-Q%q' }
Constants inherited from Pagy::Calendar
Constants inherited from Pagy
ElasticsearchRails, LABEL_PLACEHOLDER, Meilisearch, PAGE_PLACEHOLDER, Searchkick, VERSION
Instance Attribute Summary
Attributes inherited from Pagy::Calendar
Attributes inherited from Pagy
#count, #from, #in, #items, #last, #next, #offset, #page, #pages, #params, #prev, #request_path, #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::Calendar
Methods included from OverflowExtra::Pagy
Methods included from FrontendHelpers::Calendar
Methods inherited from Pagy
#initialize, #label, root, #series
Methods included from SearchkickExtra::Pagy
Methods included from MeilisearchExtra::Pagy
Methods included from ElasticsearchRailsExtra::Pagy
Methods included from GearboxExtra
#setup_items_var, #setup_offset_var, #setup_pages_var
Methods included from FrontendHelpers::Pagy
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
12 13 14 15 16 |
# File 'lib/pagy/calendar/quarter.rb', line 12 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 |