pagy 5.2.1 → 5.2.2

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: 7e5a33b40f2a12b18d7a3a4d86d367836a2e5bce8e675fea912292558f41d7bf
4
- data.tar.gz: d79570153a77422382c17eed7bf00c446c5cc13aadb237c7df3207fb57db3766
3
+ metadata.gz: 5cb4539d68931db35f7f2f8c9d53d9e8a63541f402f23621b92a51e6a2e77386
4
+ data.tar.gz: 4adbae6e3d5213c6628bec8a35a26c5e44ce09546fa6fdd74541d5bbf2feb63b
5
5
  SHA512:
6
- metadata.gz: 6e7881aac396c5049ecbdf6430d87a748e95f184bbe71b38d2c0b0cbc705cc0309c7148788534ea337a0236fae8591226d2158c78e34f06c4e557e29577f357c
7
- data.tar.gz: 166af959cf2fb5b05746a5d0a1431f29775c13059f86402003a1f1a0fd8cbd0b13af58ab7a110fd5604266507a860c24df1b538378a5a28ff4932b68b482dc2d
6
+ metadata.gz: 277754cc4da9b7bd70c173ad052c87658eda48c7a42ad28675e1b5ce3eafae09932bf3c2a1682715890bbb4039ce3484f0a1adc7f7223e6bd3702e3cfb9b0eab
7
+ data.tar.gz: 9cb4995ece3b2fe8ab5625646cb1118080d27f52ce63af8efe5fd5178a6f8e8e77e9196a7f851780057fb315368622961f70eb65f808c460d011d5d890ff69bd
data/lib/config/pagy.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Pagy initializer file (5.2.1)
3
+ # Pagy initializer file (5.2.2)
4
4
  # Customize only what you really need and notice that Pagy works also without any of the following lines.
5
5
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
6
6
 
@@ -3,7 +3,7 @@
3
3
  // Container of the whole pagy stuff
4
4
  function Pagy(){}
5
5
 
6
- Pagy.version = '5.2.1'
6
+ Pagy.version = '5.2.2'
7
7
 
8
8
  // Used by the waitForMe function
9
9
  Pagy.delay = 100
@@ -28,7 +28,7 @@ class Pagy # :nodoc:
28
28
 
29
29
  # Generates a hash structure of the headers
30
30
  def pagy_headers_hash(pagy)
31
- countless = defined?(Pagy::Countless) && pagy.is_a?(Pagy::Countless)
31
+ countless = defined?(Countless) && pagy.is_a?(Countless)
32
32
  rel = { 'first' => 1, 'prev' => pagy.prev, 'next' => pagy.next }
33
33
  rel['last'] = pagy.last unless countless
34
34
  url_str = pagy_url_for(pagy, PAGE_PLACEHOLDER, absolute: true)
@@ -39,7 +39,7 @@ class Pagy # :nodoc:
39
39
  hash = { 'Link' => link }
40
40
  headers = pagy.vars[:headers]
41
41
  hash[headers[:page]] = pagy.page.to_s if headers[:page]
42
- if headers[:items] && !(defined?(Pagy::Calendar) && pagy.is_a?(Pagy::Calendar)) # not for Calendar
42
+ if headers[:items] && !(defined?(Calendar) && pagy.is_a?(Calendar)) # items is not for Calendar
43
43
  hash[headers[:items]] = pagy.vars[:items].to_s
44
44
  end
45
45
  unless countless
@@ -17,7 +17,7 @@ class Pagy # :nodoc:
17
17
  def pagy_metadata(pagy, absolute: nil)
18
18
  scaffold_url = pagy_url_for(pagy, PAGE_PLACEHOLDER, absolute: absolute)
19
19
  {}.tap do |metadata|
20
- keys = pagy.is_a?(Calendar) ? pagy.vars[:metadata] - %i[count items] : pagy.vars[:metadata]
20
+ keys = defined?(Calendar) && pagy.is_a?(Calendar) ? pagy.vars[:metadata] - %i[count items] : pagy.vars[:metadata]
21
21
  keys.each do |key|
22
22
  metadata[key] = case key
23
23
  when :scaffold_url then scaffold_url
@@ -28,7 +28,7 @@ class Pagy # :nodoc:
28
28
  @vars[:page] = requested_page # restore the requested page
29
29
  when :empty_page
30
30
  @offset = @in = @from = @to = 0 # vars relative to the actual page
31
- if is_a?(Calendar) # only for Calendar instances
31
+ if defined?(Calendar) && is_a?(Calendar) # only for Calendar instances
32
32
  edge = @order == :asc ? @final : @initial # get the edge of the overflow side (neat, but it would work with any time)
33
33
  @utc_from = @utc_to = edge.getutc # set both to the edge utc time (a query with >= && < will get no record)
34
34
  end
data/lib/pagy.rb CHANGED
@@ -5,7 +5,7 @@ require 'pathname'
5
5
 
6
6
  # Core class
7
7
  class Pagy
8
- VERSION = '5.2.1'
8
+ VERSION = '5.2.2'
9
9
 
10
10
  # Root pathname to get the path of Pagy files like templates or dictionaries
11
11
  def self.root
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: 5.2.1
4
+ version: 5.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-07 00:00:00.000000000 Z
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Agnostic pagination in plain ruby. It does it all. Better.
14
14
  email: