pagy 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4854a1fd5d27c6aff098679de26bf6d8d9798ae80ac8437018ffea9453bd8278
4
- data.tar.gz: 7e3d14f097eb00734df266131a8284d71bc1112898fed0fccac4b52abfca1809
3
+ metadata.gz: da9304305299f0be41d53a9d6f13619fd5c625fafe1719b7d2606dc4d41689c2
4
+ data.tar.gz: 860fd52099ad641fc92ae5a0a1139a2eb93e041aa314071916f80b968dcb27fd
5
5
  SHA512:
6
- metadata.gz: 860cb78c32a7e439496940ae2a5083b47bbae26b5bd5c5c9590b5e2f6d251feb1ec8bd9dbdcbcab0ffcc972c0a0832522f68ed410e9900ce5f5ee3c7cdbf0a62
7
- data.tar.gz: 2a0003898d272902131032fef6edad510596f70ca1a52c937a79cb3a384bc5c1a5147604eec93dd0b895a5c16669872423b1093bd777cd4c80ad692d1d060aa8
6
+ metadata.gz: 1092d3a3c662c9e88ceafd7a5062ca157b1115129878bdb8751de0609422360d07607eb60d4b277a2c18b1253acaf6d39552d314fdd0b679326b445874af00a6
7
+ data.tar.gz: 2ade9847094373264920036d0ce2fa9eaebcc7d912115f6614799a3f5b078d3b32317db627e2ec23c8dee8df119cc6c976dce1371781e16b1631aac7798b543e
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'pathname'
5
5
 
6
- class Pagy ; VERSION = '0.15.1'
6
+ class Pagy ; VERSION = '0.16.0'
7
7
 
8
8
  class OutOfRangeError < StandardError; attr_reader :pagy; def initialize(pagy) @pagy = pagy end; end
9
9
 
@@ -41,6 +41,10 @@
41
41
  # See https://ddnexus.github.io/pagy/extras/responsive#breakpoints
42
42
  # Pagy::VARS[:breakpoints] = { 0 => [1,2,2,1], 350 => [2,3,3,2], 550 => [3,4,4,3] } # example of width/size pairs
43
43
 
44
+ # Searchkick: Paginate `Searchkick::Results` objects efficiently avoiding expensive oject-wrapping and without overriding.
45
+ # See https://ddnexus.github.io/pagy/extras/searchkick
46
+ # require 'pagy/extras/searchkick'
47
+
44
48
  # Trim: Remove the page=1 param from links
45
49
  # See https://ddnexus.github.io/pagy/extras/trim
46
50
  # require 'pagy/extras/trim'
@@ -0,0 +1,19 @@
1
+ # See the Pagy documentation: https://ddnexus.github.io/pagy/extras/searchkick
2
+
3
+ class Pagy
4
+ # Add specialized backend methods to paginate Searchkick::Results
5
+ module Backend ; private
6
+ # Return Pagy object and items
7
+ def pagy_searchkick(results, vars={})
8
+ pagy = Pagy.new(pagy_searchkick_get_vars(results, vars))
9
+ return pagy, results
10
+ end
11
+
12
+ def pagy_searchkick_get_vars(results, vars)
13
+ # Return the merged variables to initialize the Pagy object
14
+ { count: results.total_count,
15
+ page: results.options[:page],
16
+ items: results.options[:per_page] }.merge!(vars)
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-04 00:00:00.000000000 Z
11
+ date: 2018-08-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Agnostic pagination in plain ruby: it works with any framework, ORM
14
14
  and DB type, with all kinds of collections, even pre-paginated, scopes, Arrays,
@@ -36,6 +36,7 @@ files:
36
36
  - lib/pagy/extras/materialize.rb
37
37
  - lib/pagy/extras/out_of_range.rb
38
38
  - lib/pagy/extras/responsive.rb
39
+ - lib/pagy/extras/searchkick.rb
39
40
  - lib/pagy/extras/templates/nav.html.erb
40
41
  - lib/pagy/extras/templates/nav.html.haml
41
42
  - lib/pagy/extras/templates/nav.html.slim