Module: Pagy::Deprecated::Countless
- Included in:
- Offset::Countless
- Defined in:
- lib/pagy/deprecated.rb
Instance Method Summary collapse
Instance Method Details
#finalize(fetched_size) ⇒ Object
49 50 51 52 |
# File 'lib/pagy/deprecated.rb', line 49 def finalize(fetched_size) super @last = upto_max_pages(@last) end |
#initialize ⇒ Object
43 44 45 46 47 |
# File 'lib/pagy/deprecated.rb', line 43 def initialize(**) super @page = upto_max_pages(@page) @last = upto_max_pages(@last) unless @options[:headless] end |
#upto_max_pages(value) ⇒ Object
54 55 56 57 58 |
# File 'lib/pagy/deprecated.rb', line 54 def upto_max_pages(value) return value unless value && @options[:max_pages] [value, @options[:max_pages]].min end |