simple-sql 0.4.39 → 0.4.40

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: cbc1ba2ac08457fcddf1455ab47b006030071b15ca4b9944bf7d4e4a49b9b0fe
4
- data.tar.gz: b0910c6ecfb1978ecf4d1e42e3017a240e8987152b27a2934b85447f2c33dc89
3
+ metadata.gz: b7aec21685ece83267046a3e9c9598034dc32f9d3abf5ae9e865086de2e0c76a
4
+ data.tar.gz: d7b7f03907c3227170051400fb9bd3c5a858158d0e547b3358cbb2f5313cba7c
5
5
  SHA512:
6
- metadata.gz: dce03ed034f5625917a9cb6b10607c0422c2ada5aa47921971a800b0e3fb71688680a3d6babee7097d2bdc7556c14b1b21f7c4b3f11c9992ad0922b199401126
7
- data.tar.gz: 8e3703eef2c956cff3a41f9e5de008b67de2343ae34901cb0f50b37c47e55f6e5a15b22952844a0c1266a1d4c033b1a0a3e728560683570114071b1bcb350857
6
+ metadata.gz: 71b76a7de9e626e56a94f01c2243d55f208c0b26da08318b711aead2c484afcc056ec0d15312824b8f8ee269ade7ec00e8aa1fa93974345d31336b84637c865a
7
+ data.tar.gz: 5fe760ec0b14d8b1cc5ba87209130d12036bfd34eedf3ea3081597c5fb752cc322e656a00a66c0225f34e3334e272e75c0af3eb718a86cc78c2698d236efb278
@@ -1,4 +1,6 @@
1
1
  # rubocop:disable Naming/AccessorMethodName
2
+ # rubocop:disable Style/DoubleNegation
3
+ # rubocop:disable Style/GuardClause
2
4
 
3
5
  require_relative "helpers"
4
6
 
@@ -66,31 +68,31 @@ class ::Simple::SQL::Result < Array
66
68
  end
67
69
 
68
70
  def paginated?
69
- !! @pagination_scope
71
+ !!@pagination_scope
70
72
  end
71
73
 
72
74
  private
73
75
 
74
76
  def pagination_scope
75
77
  raise "Only available only for paginated scopes" unless paginated?
76
-
78
+
77
79
  @pagination_scope
78
80
  end
79
81
 
80
82
  def set_pagination_info(scope)
81
83
  raise ArgumentError, "per must be > 0" unless scope.per > 0
82
84
 
85
+ @pagination_scope = scope
86
+
87
+ # This branch is an optimization: the call to the database to count is
88
+ # not necessary if we know that there are not even any results on the
89
+ # first page.
83
90
  if scope.page <= 1 && empty?
84
- # This branch is an optimization: the call to the database to count is
85
- # not necessary if we know that there are not even any results on the
86
- # first page.
87
91
  @current_page = 1
88
92
  @total_count = 0
89
93
  @total_pages = 1
90
94
  @total_fast_count = 0
91
95
  @total_fast_pages = 1
92
- else
93
- @pagination_scope = scope
94
96
  end
95
97
  end
96
98
  end
@@ -1,5 +1,5 @@
1
1
  module Simple
2
2
  module SQL
3
- VERSION = "0.4.39"
3
+ VERSION = "0.4.40"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.39
4
+ version: 0.4.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel