class RailsPaginate::Renderers::Base

base method

Attributes

collection[R]
options[R]
pager[R]
view[R]

Public Class Methods

new(view, collection, pager, options = {}) click to toggle source

setup rails_paginate collection

# File lib/rails_paginate/renderers/base.rb, line 7
def initialize(view, collection, pager, options = {})
  raise ArgumentError, "first argument must be a RailsPaginate::Collection" unless collection.is_a? RailsPaginate::Collection
  raise ArgumentError, "second argument must be a Hash" unless options.is_a? Hash
  raise ArgumentError, "third argument must be an instance of RailsPaginate::Pagers::Base" unless pager.is_a? RailsPaginate::Pagers::Base
  @options = options
  @collection = collection
  @view = view
  @pager = pager
end

Public Instance Methods

render() click to toggle source

abstrack renderer

# File lib/rails_paginate/renderers/base.rb, line 23
def render
  raise StandardError, "render is not implemented"
end
url_for_page(page) click to toggle source

build url

# File lib/rails_paginate/renderers/base.rb, line 18
def url_for_page(page)
  view.url_for(view.default_url_options.merge({page_param.to_sym => page}).merge(options[:params] || {}))
end

Protected Instance Methods

content_tag(*args, &block) click to toggle source

map to view helper

# File lib/rails_paginate/renderers/base.rb, line 52
def content_tag(*args, &block)
  view.content_tag(*args, &block)
end
current_page() click to toggle source

helper

# File lib/rails_paginate/renderers/base.rb, line 47
def current_page
  collection.current_page
end
page_param() click to toggle source
# File lib/rails_paginate/renderers/base.rb, line 42
def page_param
  options[:page_param] || RailsPaginate.page_param
end
t(*args) click to toggle source

map to view helper

# File lib/rails_paginate/renderers/base.rb, line 62
def t(*args)
  view.t(*args)
end