Module: Pagy::UseTrimExtra
- Included in:
- Frontend
- Defined in:
- lib/pagy/extras/trim.rb
Instance Method Summary collapse
Instance Method Details
#pagy_link_proc(pagy, link_extra = '') ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/pagy/extras/trim.rb', line 10 def pagy_link_proc(pagy, link_extra='') link_proc = super(pagy, link_extra) return link_proc unless pagy.vars[:trim] lambda do |num, text=num, extra=''| link = link_proc.call(num, text, extra) return link unless num == 1 link.sub!(/[?&]#{pagy.vars[:page_param]}=1\b(?!&)|\b#{pagy.vars[:page_param]}=1&/, '') end end |