pagy 5.3.0 → 5.3.1

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: b456869f0028668579c9839d1083b7baf7693d593fcbed24f371bc52dfff4467
4
- data.tar.gz: ec4f4b71da52860950262812d2bfbbe9190b1f0a1c3836cbc8f316e0c04ecd0b
3
+ metadata.gz: e3530b69891d7c069acdb707d6fa54e8b5d31763a80e57dae2e0fe3afafce8b2
4
+ data.tar.gz: defdc75e9f60ae351e8b071fffd3bf4767e28d51edd8ec6398a1b5958d688084
5
5
  SHA512:
6
- metadata.gz: e16ea640c3cc34b506c02d585c48fa8365b1a5e67d3b487d69669aa9d700a1f930929844e92759929f3963e78f2d72c53b4ef2d4caefeb2adbbff262ff0dd54d
7
- data.tar.gz: 3086cf995b60b71212b64b42d7998e2f2831883abf41d22f9952b0632143936871a4c50d16da6b1849e805ce90de190be555e96ba893b5ee28c01b8650af7e03
6
+ metadata.gz: 13dc93a7f0de2f1e4a688292e1901905df218d500fe1543e4d518dab1f1e7f7d2276cc63f197c251b1ed14e8fea4b46d8be4590ccbad89cfed11d70481a769a2
7
+ data.tar.gz: f6ddac95479d63445920df9bad22142f59b9b14e2a4c758303c76389eefd1a475ce49dd1e781e70519bed0a081c1b2296bb19be6ca6e50feefa0abb9660749a6
data/lib/config/pagy.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Pagy initializer file (5.3.0)
3
+ # Pagy initializer file (5.3.1)
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
 
@@ -5,7 +5,7 @@
5
5
  // Container of the whole pagy stuff
6
6
  function Pagy(){}
7
7
 
8
- Pagy.version = '5.3.0'
8
+ Pagy.version = '5.3.1'
9
9
 
10
10
  // Used by the waitForMe function
11
11
  Pagy.delay = 100
data/lib/pagy/calendar.rb CHANGED
@@ -32,7 +32,7 @@ class Pagy # :nodoc:
32
32
  end
33
33
 
34
34
  # Generate a label for each page, with the specific `Time` period it refers to
35
- # It can pass along the I18n gem opts when it's used with the i18n extra
35
+ # (it can pass along the I18n gem opts when it's used with the i18n extra)
36
36
  def label_for(page, **opts)
37
37
  snap = snap(page.to_i)
38
38
  time = case @unit
@@ -43,11 +43,11 @@ class Pagy # :nodoc:
43
43
  else raise InternalError, "expected @unit to be in [:year, :month, :week, :day]; got #{@unit.inspect}"
44
44
  end
45
45
  opts[:format] ||= @vars[:"#{@unit}_format"]
46
- strftime(time, **opts)
46
+ localize(time, **opts)
47
47
  end
48
48
 
49
49
  # The label for the current page
50
- # It can pass along the I18n gem opts when it's used with the i18n extra
50
+ # (it can pass along the I18n gem opts when it's used with the i18n extra)
51
51
  def label(**opts)
52
52
  label_for(@page, **opts)
53
53
  end
@@ -69,7 +69,7 @@ class Pagy # :nodoc:
69
69
 
70
70
  min, max = @vars[:local_minmax]
71
71
  raise VariableError.new(self, :local_minmax, 'to be a an Array of min and max local Time instances', @vars[:local_minmax]) \
72
- unless min.is_a?(Time) && max.is_a?(Time) && !min.utc? && !min.utc? && min <= max \
72
+ unless min.is_a?(Time) && max.is_a?(Time) && !min.utc? && !max.utc? && min <= max \
73
73
  && (@utc_offset = min.utc_offset) == max.utc_offset
74
74
 
75
75
  send :"setup_#{@unit}_vars", min, max
@@ -118,8 +118,9 @@ class Pagy # :nodoc:
118
118
  @utc_to = @utc_from + DAY
119
119
  end
120
120
 
121
- # The last method in the labelling chain: it is overridden by the I18n when localization is required.
122
- def strftime(time, **opts)
121
+ # Apply the strftime format to the time
122
+ # (overridden by the i18n extra when localization is required)
123
+ def localize(time, **opts)
123
124
  time.strftime(opts[:format])
124
125
  end
125
126
 
@@ -25,11 +25,11 @@ class Pagy # :nodoc:
25
25
  end
26
26
 
27
27
  # This method should be implemented in the application and should return the records
28
- # for the unit by selecting the records with DateTime from pagy.from to pagy.to
28
+ # for the unit by selecting the records with Time from pagy.utc_from to pagy.utc_to
29
29
  def pagy_calendar_get_items(_collection, _pagy)
30
- # collection.your_own_method_to_get_the_items_with(pagy.from, pagy.to)
30
+ # collection.your_own_method_to_get_the_items_with(pagy.utc_from, pagy.utc_to)
31
31
  raise NoMethodError, 'The pagy_calendar_get_items method must be implemented in the application and must return ' \
32
- 'the items for the unit by selecting the records with Time from pagy.from to pagy.to'
32
+ 'the items for the unit by selecting the records with Time from pagy.utc_from to pagy.utc_to'
33
33
  end
34
34
  end
35
35
  end
@@ -13,7 +13,7 @@ class Pagy # :nodoc:
13
13
 
14
14
  # Calendar overriding
15
15
  module Calendar
16
- def strftime(time, **opts)
16
+ def localize(time, **opts)
17
17
  ::I18n.l(time, **opts)
18
18
  end
19
19
  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.3.0'
8
+ VERSION = '5.3.1'
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.3.0
4
+ version: 5.3.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: 2021-11-10 00:00:00.000000000 Z
11
+ date: 2021-11-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Agnostic pagination in plain ruby. It does it all. Better.
14
14
  email: