pagy 3.8.0 → 3.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a3ba0f375dbf0278f8701c8cd68b628c207543556da9779c195a441c8c92896
4
- data.tar.gz: 40656e0eaeb6b8bfe45126100242e6b89edd588e6723b98c1a120787e2ff77cb
3
+ metadata.gz: 7ea52feecd4bb597b050def40adc283602005ff5e92b4df578228e05d747f9ef
4
+ data.tar.gz: 808775763c37c92e3457214284fffcfc1075a7c8fbde1da39286b35c06923424
5
5
  SHA512:
6
- metadata.gz: d2e5fe320e18656b1c9e7fb0d36597ee6a4ad8fcb55579b269ea8f394b390975e7f7e1138484b158ee5099bccfa6ee16e6c780513c68866d0b08367aa77c8919
7
- data.tar.gz: 5b3c2c1deeb0f4131044e8b5830394080c31e5ddd49cb6c07e9124da5a14d5d15dfcf9c69e34775b7f9249193e6d6064c52316ce7703e9b53319b3c235b08adc
6
+ metadata.gz: 80015e89122214f8e8054e2c8e8490b407f4fb9513a4336458eeedd2b5bc986e27abf339830157392afd9cd8f901d61fcd0403480fe7acb093da27d68f9d800b
7
+ data.tar.gz: ec2ab4d61e3763c580d011565811a55595b15f1f7498b9879dd20f6986f5b470f155f1f4ff5c74286892836c5a2f133e0f2d17e32f82d2b0e1e737a876b89155
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- # Pagy initializer file (3.8.0)
4
+ # Pagy initializer file (3.8.1)
5
5
  # Customize only what you really need and notice that Pagy works also without any of the following lines.
6
6
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
7
7
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  function Pagy(){}
4
4
 
5
- Pagy.version = '3.8.0';
5
+ Pagy.version = '3.8.1';
6
6
 
7
7
  Pagy.init = function(arg){
8
8
  var target = arg instanceof Event || arg === undefined ? document : arg,
@@ -101,6 +101,6 @@ Pagy.addInputEventListeners = function(input, handler){
101
101
  };
102
102
 
103
103
  Pagy.trim = function(html, param){
104
- var re = new RegExp('[?&]' + param + '=1\b(?!&)|\b' + param + '=1&');
104
+ var re = new RegExp('[?&]' + param + '=1\\b(?!&)|\\b' + param + '=1&');
105
105
  return html.replace(re, '');
106
106
  };
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'pathname'
6
6
 
7
- class Pagy ; VERSION = '3.8.0'
7
+ class Pagy ; VERSION = '3.8.1'
8
8
 
9
9
  # Root pathname to get the path of Pagy files like templates or dictionaries
10
10
  def self.root; @root ||= Pathname.new(__FILE__).dirname.freeze end
@@ -28,7 +28,7 @@ class Pagy
28
28
  search_args[-1][:size] = vars[:items]
29
29
  search_args[-1][:from] = vars[:items] * (vars[:page] - 1)
30
30
  response = model.search(*search_args)
31
- total = response.raw_response['hits']['total']
31
+ total = response.respond_to?(:raw_response) ? response.raw_response['hits']['total'] : response.response['hits']['total']
32
32
  vars[:count] = total.is_a?(Hash) ? total['value'] : total
33
33
  pagy = Pagy.new(vars)
34
34
  # with :last_page overflow we need to re-run the method in order to get the hits
@@ -11,7 +11,14 @@ class Pagy
11
11
  Pagy::I18n.clear.instance_eval { undef :load; undef :t } # unload the pagy default constant for efficiency
12
12
 
13
13
  alias_method :pagy_without_i18n, :pagy_t
14
- def pagy_t_with_i18n(*args) ::I18n.t(*args) end
14
+ if Gem::Version.new(::I18n::VERSION) < Gem::Version.new('1.6.0')
15
+ def pagy_t_with_i18n(*args) ::I18n.t(*args) end
16
+ else
17
+ # keep 1.9 compatibility by hiding 2.0+ syntax in string
18
+ module_eval <<-RUBY
19
+ def pagy_t_with_i18n(key, **opts) ::I18n.t(key, **opts) end
20
+ RUBY
21
+ end
15
22
  alias_method :pagy_t, :pagy_t_with_i18n
16
23
 
17
24
  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: 3.8.0
4
+ version: 3.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2020-05-08 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,
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.0.6
113
+ rubygems_version: 3.1.2
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: The Ultimate Pagination Ruby Gem