Class: SimplePaginate::Helpers::Paginator

Inherits:
Tag
  • Object
show all
Includes:
ActionView::Context
Defined in:
lib/simple_paginate/helpers/paginator.rb

Defined Under Namespace

Classes: PageProxy

Instance Method Summary collapse

Methods inherited from Tag

#page_url_for

Constructor Details

#initialize(template, options) ⇒ Paginator

Returns a new instance of Paginator.



9
10
11
12
# File 'lib/simple_paginate/helpers/paginator.rb', line 9

def initialize(template, options)
  super template, options.merge(current_page: PageProxy.new(options))
  @output_buffer = ActionView::OutputBuffer.new
end

Instance Method Details

#next_page_tagObject



23
24
25
# File 'lib/simple_paginate/helpers/paginator.rb', line 23

def next_page_tag
  NextPage.new @template, @options
end

#prev_page_tagObject



19
20
21
# File 'lib/simple_paginate/helpers/paginator.rb', line 19

def prev_page_tag
  PrevPage.new @template, @options
end

#render(&block) ⇒ Object



14
15
16
17
# File 'lib/simple_paginate/helpers/paginator.rb', line 14

def render(&block)
  instance_eval(&block)
  @output_buffer
end

#to_sObject



27
28
29
# File 'lib/simple_paginate/helpers/paginator.rb', line 27

def to_s
  super @options.merge(paginator: self)
end