Module: Rwsc::Utils::Pager
- Included in:
- BooksTotalSearch
- Defined in:
- lib/rwsc/utils/pager.rb
Instance Method Summary collapse
Instance Method Details
#[](page) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rwsc/utils/pager.rb', line 26 def [](page) if page < 1 or page > self.last.to_i return nil end opts = opts[:page] = page.to_s eval("#{opts[:operation]}.find(opts)") end |
#next_page ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/rwsc/utils/pager.rb', line 6 def next_page if self.page >= self.last return nil end opts = opts[:page] = (self.page.to_i + 1).to_s eval("#{opts[:operation]}.find(opts)") end |
#previous_page ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/rwsc/utils/pager.rb', line 16 def previous_page if self.page.to_i <= 1 return nil end opts = opts[:page] = (self.page.to_i - 1).to_s eval("#{opts[:operation]}.find(opts)") end |