Class: Kaminari::Helpers::Paginator
- Includes:
- Renderable
- Defined in:
- lib/kaminari/helpers/tags.rb
Overview
The container tag
Defined Under Namespace
Classes: PageProxy
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#each_page ⇒ Object
enumerate each page providing PageProxy object as the block parameter.
-
#initialize(template, window_options) ⇒ Paginator
constructor
:nodoc:.
-
#render(&block) ⇒ Object
render given block as a view template.
-
#to_s(window_options = {}) ⇒ Object
:nodoc:.
Methods included from Renderable
Constructor Details
#initialize(template, window_options) ⇒ Paginator
:nodoc:
74 75 76 77 78 |
# File 'lib/kaminari/helpers/tags.rb', line 74 def initialize(template, ) #:nodoc: @template, @options = template, .reverse_merge(template.) # so that this instance can actually "render". Black magic? @output_buffer = ActionView::OutputBuffer.new end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
72 73 74 |
# File 'lib/kaminari/helpers/tags.rb', line 72 def @options end |
Instance Method Details
#each_page ⇒ Object
enumerate each page providing PageProxy object as the block parameter
87 88 89 90 91 92 |
# File 'lib/kaminari/helpers/tags.rb', line 87 def each_page 1.upto(@options[:num_pages]) do |i| @page = i yield PageProxy.new(, i, @last) end end |
#render(&block) ⇒ Object
render given block as a view template
81 82 83 84 |
# File 'lib/kaminari/helpers/tags.rb', line 81 def render(&block) instance_eval &block if @options[:num_pages] > 1 @output_buffer end |
#to_s(window_options = {}) ⇒ Object
:nodoc:
110 111 112 |
# File 'lib/kaminari/helpers/tags.rb', line 110 def to_s( = {}) #:nodoc: super .merge :paginator => self end |