Module: Sinatra::Pagers::Helpers

Defined in:
lib/sinatra/pagers.rb

Overview

Helpers for Module Pagers

Instance Method Summary collapse

Instance Method Details

#get_pager(extra = []) ⇒ Object

Retrieve a pager object. Params are: page, dataset, cpp, order



193
194
195
196
197
198
199
200
201
202
# File 'lib/sinatra/pagers.rb', line 193

def  get_pager(extra=[])
  pager=Pager.new
  [:page,:query,:cpp, :order].each {|prop|
    pager.send("#{prop}=",params[prop.to_s]) if params[prop.to_s]
  }
  extra.each {|prop|
    pager.extra[prop]=params[prop.to_s] if params[prop.to_s]
  }
  pager
end