Class: SimplePaginate::Helpers::Tag
- Inherits:
-
Object
- Object
- SimplePaginate::Helpers::Tag
show all
- Defined in:
- lib/simple_paginate/helpers/tags.rb
Instance Method Summary
collapse
Constructor Details
#initialize(template, options = {}) ⇒ Tag
Returns a new instance of Tag.
7
8
9
10
11
12
13
14
15
|
# 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
@params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
@params = @params.with_indifferent_access
@params.except!(*PARAM_KEY_BLACKLIST)
@params.merge!(@options.delete(:params) || {})
end
|
Instance Method Details
#page_url_for(page) ⇒ Object
21
22
23
|
# File 'lib/simple_paginate/helpers/tags.rb', line 21
def page_url_for(page)
@template.url_for params_for(page).merge(only_path: true)
end
|
#to_s(locals = {}) ⇒ Object
17
18
19
|
# File 'lib/simple_paginate/helpers/tags.rb', line 17
def to_s(locals = {})
@template.render partial: partial_path, locals: @options.merge(locals), formats: [:html]
end
|