Class: Resourcey::Paginator
- Inherits:
-
Object
- Object
- Resourcey::Paginator
show all
- Defined in:
- lib/resourcey/paginator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(params) ⇒ Paginator
Returns a new instance of Paginator.
5
6
7
8
|
# File 'lib/resourcey/paginator.rb', line 5
def initialize(params)
parsed_params = parse_params(params)
setup(parsed_params)
end
|
Class Method Details
.class_for(name) ⇒ Object
25
26
27
28
|
# File 'lib/resourcey/paginator.rb', line 25
def class_for(name)
paginator_name = "#{name.to_s.camelize}Paginator"
paginator_name.safe_constantize || raise(Errors::ClassNotFound.new(paginator_name))
end
|
.permit_params(*args) ⇒ Object
30
31
32
|
# File 'lib/resourcey/paginator.rb', line 30
def permit_params(*args)
self.allowed_params = args
end
|
Instance Method Details
#paginate(*args) ⇒ Object
14
15
16
|
# File 'lib/resourcey/paginator.rb', line 14
def paginate(*args)
raise Errors::NotImplemented.new(:paginate)
end
|
#parse_params(params) ⇒ Object
10
11
12
|
# File 'lib/resourcey/paginator.rb', line 10
def parse_params(params)
params.permit(self.allowed_params)
end
|
#setup(*args) ⇒ Object
18
19
20
|
# File 'lib/resourcey/paginator.rb', line 18
def setup(*args)
raise Errors::NotImplemented.new(:setup)
end
|