pager_api 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pager_api/hooks.rb +17 -15
- data/lib/pager_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59b7e16a70f5f9a9defe754c36e8107ee2dbe16f1ac048926b389067c92651f3
|
4
|
+
data.tar.gz: 192f9eaa768cfc4af32d6d7eeeaa7a2481e7fa90083ea4def249fd947670139e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e1c7db162f8945b97b990a4967aad29ad2f48894df4f40700e8f69261c90066d190de82bae76214d6451afdeba4c4cee2d1cba5bc6f6c9cebc669f3d764a07e
|
7
|
+
data.tar.gz: 2ee6d7f5f40531062bcd7ed07ad4a2abfe2688f12359f8c9c85c025cf9744878e78f21bfa0018cc6d7877458d521c05aeca03290c0ad28fe52057263a68a7dd4
|
data/lib/pager_api/hooks.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
|
-
|
2
|
-
begin; require "will_paginate"; rescue LoadError; end
|
3
|
-
begin; require "pagy"; rescue LoadError; end
|
1
|
+
pagination_handler_name = PagerApi.pagination_handler.to_s
|
4
2
|
|
5
|
-
|
6
|
-
require
|
7
|
-
|
8
|
-
if defined?(ActionController::Base)
|
9
|
-
ActionController::Base.send(:include, "PagerApi::Pagination::#{PagerApi.pagination_handler.to_s.classify}".constantize)
|
10
|
-
else
|
11
|
-
ActionController::API.send(:include, "PagerApi::Pagination::#{PagerApi.pagination_handler.to_s.classify}".constantize)
|
12
|
-
end
|
13
|
-
|
14
|
-
unless defined?(Kaminari) or defined?(WillPaginate) or defined?(Pagy)
|
3
|
+
begin
|
4
|
+
require pagination_handler_name
|
5
|
+
rescue LoadError
|
15
6
|
Kernel.warn <<-WARNING.gsub(/^\s{4}/, "")
|
16
|
-
Warning: pager-api needs
|
7
|
+
Warning: pager-api needs #{pagination_handler_name} as a dependency.
|
17
8
|
You need to add it to your Gemfile
|
18
9
|
|
19
|
-
gem '
|
10
|
+
gem '#{pagination_handler_name}'
|
11
|
+
|
12
|
+
Also you can change pagination_handler in pager_api initializer
|
20
13
|
WARNING
|
21
14
|
end
|
15
|
+
|
16
|
+
# Dynamic pagination handler call
|
17
|
+
require "pager_api/pagination/#{pagination_handler_name}"
|
18
|
+
|
19
|
+
if defined?(ActionController::Base)
|
20
|
+
ActionController::Base.send(:include, "PagerApi::Pagination::#{pagination_handler_name.classify}".constantize)
|
21
|
+
else
|
22
|
+
ActionController::API.send(:include, "PagerApi::Pagination::#{pagination_handler_name.classify}".constantize)
|
23
|
+
end
|
data/lib/pager_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pager_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abraham Kuri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|