Class: SimplePaginate::Helpers::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_paginate/helpers/tags.rb

Direct Known Subclasses

NextPage, Page, Paginator, PrevPage

Instance Method Summary collapse

Constructor Details

#initialize(template, options = {}) ⇒ Tag

Returns a new instance of Tag.



7
8
9
10
11
# File 'lib/simple_paginate/helpers/tags.rb', line 7

def initialize(template, options = {})
  @template, @options = template, options
  @views_prefix = @options.delete(:views_prefix)
  @params = template.params.except(*PARAM_KEY_BLACKLIST).merge(@options.delete(:params) || {})
end

Instance Method Details

#page_url_for(page) ⇒ Object



17
18
19
# File 'lib/simple_paginate/helpers/tags.rb', line 17

def page_url_for(page) 
  @template.url_for params_for(page).merge(only_path: true)
end

#to_s(locals = {}) ⇒ Object



13
14
15
# File 'lib/simple_paginate/helpers/tags.rb', line 13

def to_s(locals = {})
  @template.render partial: partial_path, locals: @options.merge(locals), formats: [:html]
end