Class: RailsPaginate::Renderers::Base
- Inherits:
-
Object
- Object
- RailsPaginate::Renderers::Base
- Defined in:
- lib/rails_paginate/renderers/base.rb
Overview
base method
Direct Known Subclasses
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#pager ⇒ Object
readonly
Returns the value of attribute pager.
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
-
#initialize(view, collection, pager, options = {}) ⇒ Base
constructor
setup rails_paginate collection.
-
#render ⇒ Object
abstrack renderer.
-
#url_for_page(page) ⇒ Object
build url.
Constructor Details
#initialize(view, collection, pager, options = {}) ⇒ Base
setup rails_paginate collection
7 8 9 10 11 12 13 14 15 |
# File 'lib/rails_paginate/renderers/base.rb', line 7 def initialize(view, collection, pager, = {}) raise ArgumentError, "first argument must be a RailsPaginate::Collection" unless collection.is_a? RailsPaginate::Collection raise ArgumentError, "second argument must be a Hash" unless .is_a? Hash raise ArgumentError, "third argument must be an instance of RailsPaginate::Pagers::Base" unless pager.is_a? RailsPaginate::Pagers::Base @options = @collection = collection @view = view @pager = pager end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
4 5 6 |
# File 'lib/rails_paginate/renderers/base.rb', line 4 def collection @collection end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/rails_paginate/renderers/base.rb', line 4 def @options end |
#pager ⇒ Object (readonly)
Returns the value of attribute pager.
4 5 6 |
# File 'lib/rails_paginate/renderers/base.rb', line 4 def pager @pager end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
4 5 6 |
# File 'lib/rails_paginate/renderers/base.rb', line 4 def view @view end |
Instance Method Details
#render ⇒ Object
abstrack renderer
23 24 25 |
# File 'lib/rails_paginate/renderers/base.rb', line 23 def render raise StandardError, "render is not implemented" end |
#url_for_page(page) ⇒ Object
build url
18 19 20 |
# File 'lib/rails_paginate/renderers/base.rb', line 18 def url_for_page(page) view.url_for(view..merge({page_param.to_sym => page})) end |