Class: GearedPagination::Ratios
- Inherits:
-
Object
- Object
- GearedPagination::Ratios
- Defined in:
- lib/geared_pagination/ratios.rb
Constant Summary collapse
- DEFAULTS =
[ 15, 30, 50, 100 ]
Instance Method Summary collapse
- #[](page_number) ⇒ Object
- #cache_key ⇒ Object
- #fixed ⇒ Object
-
#initialize(ratios = nil) ⇒ Ratios
constructor
A new instance of Ratios.
- #size ⇒ Object
Constructor Details
Instance Method Details
#[](page_number) ⇒ Object
9 10 11 |
# File 'lib/geared_pagination/ratios.rb', line 9 def [](page_number) @ratios[page_number - 1] || fixed end |
#cache_key ⇒ Object
13 14 15 |
# File 'lib/geared_pagination/ratios.rb', line 13 def cache_key @ratios.join('-') end |
#fixed ⇒ Object
21 22 23 |
# File 'lib/geared_pagination/ratios.rb', line 21 def fixed @ratios.last end |
#size ⇒ Object
17 18 19 |
# File 'lib/geared_pagination/ratios.rb', line 17 def size @ratios.size end |