groupdate 6.4.0 → 6.5.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: cdca24f5af218da761aff856a2798e39d4469fa5cdf5186d061572cea4b256a6
4
- data.tar.gz: 3b327397c8ba2638ccda503d3d3fd9d641b86cf8018161fc3cbb7891122d3b3f
3
+ metadata.gz: 1ef9a0ee3177e94a0e797036221d6e33b124e41f7f867fe8b0904a24bd7cf741
4
+ data.tar.gz: 73ef98496e157ba77bc8afb226c625dc9f117347b676eb39d767f4d55023309a
5
5
  SHA512:
6
- metadata.gz: 0b06dcf600f13158dbf4d5edeab2212aedd21b4a2e4efb36d26ab1635c035c562e28932b03ed26bdb452c5118c125d38fc8ea665e2dc5c458a986bd87e62912b
7
- data.tar.gz: 0b78a8ee21b370052d1eacffa3c5c42ceb059ec1a1d14a7b992076cd02cfe158dc6ecee027578aeb233d2adc1c3fa4e71b2f572bf87affd51077b2282e6b2e21
6
+ metadata.gz: b38cacba795f7f0e0430fa1c1935b5e2aa6556926b70533966e912f5a7110291bb2a5f6542c37c6fd7bb996cf973db5241eb7299a8c664e327026fb702cf191a
7
+ data.tar.gz: 393f55d1892c6b65cbe51608aaee4f7e1f2a06067637196a1d6ed82e69434ebb10169553308f21cb8738d06513e19eb505657ccea8d47544da85ca3c77eff02d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 6.5.0 (2024-10-01)
2
+
3
+ - Added support for Active Record 8
4
+ - Dropped support for Ruby < 3.1 and Active Record < 7
5
+
1
6
  ## 6.4.0 (2023-09-13)
2
7
 
3
8
  - Added support for Trilogy
@@ -173,7 +178,7 @@ Breaking changes
173
178
  - Added `default_value` option
174
179
  - Accept symbol for `format` option
175
180
  - Raise `ArgumentError` if no field specified
176
- - Added support for ActiveRecord 5 beta
181
+ - Added support for Active Record 5 beta
177
182
 
178
183
  ## 2.5.0 (2015-09-29)
179
184
 
@@ -187,18 +192,18 @@ Breaking changes
187
192
  - Added `carry_forward` option
188
193
  - Added `series: false` option for arrays and hashes
189
194
  - Fixed issue w/ Brasilia Summer Time
190
- - Fixed issues w/ ActiveRecord 4.2
195
+ - Fixed issues w/ Active Record 4.2
191
196
 
192
197
  ## 2.3.0 (2014-08-31)
193
198
 
194
- - Raise error when ActiveRecord::Base.default_timezone is not `:utc`
199
+ - Raise error when `ActiveRecord::Base.default_timezone` is not `:utc`
195
200
  - Added `day_of_month`
196
201
  - Added `month_of_year`
197
202
  - Do not quote column name
198
203
 
199
204
  ## 2.2.1 (2014-06-23)
200
205
 
201
- - Fixed ActiveRecord 3 associations
206
+ - Fixed Active Record 3 associations
202
207
 
203
208
  ## 2.2.0 (2014-06-22)
204
209
 
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2022 Andrew Kane
1
+ Copyright (c) 2013-2024 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -15,7 +15,7 @@ Supports PostgreSQL, MySQL, and Redshift, plus arrays and hashes (and limited su
15
15
 
16
16
  :cupid: Goes hand in hand with [Chartkick](https://www.chartkick.com)
17
17
 
18
- [![Build Status](https://github.com/ankane/groupdate/workflows/build/badge.svg?branch=master)](https://github.com/ankane/groupdate/actions)
18
+ [![Build Status](https://github.com/ankane/groupdate/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/groupdate/actions)
19
19
 
20
20
  ## Installation
21
21
 
@@ -280,18 +280,6 @@ If your application’s time zone is set to something other than `Etc/UTC` (the
280
280
  Groupdate.time_zone = false
281
281
  ```
282
282
 
283
- ## Upgrading
284
-
285
- ### 6.0
286
-
287
- Groupdate 6.0 protects against unsafe input by default. For non-attribute arguments, use:
288
-
289
- ```ruby
290
- User.group_by_day(Arel.sql(known_safe_value)).count
291
- ```
292
-
293
- Also, the `dates` option has been removed.
294
-
295
283
  ## History
296
284
 
297
285
  View the [changelog](https://github.com/ankane/groupdate/blob/master/CHANGELOG.md)
@@ -5,7 +5,7 @@ module Enumerable
5
5
  raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 0)" if args.any?
6
6
  Groupdate::Magic::Enumerable.group_by(self, period, options, &block)
7
7
  elsif respond_to?(:scoping)
8
- scoping { @klass.group_by_period(period, *args, **options, &block) }
8
+ scoping { klass.group_by_period(period, *args, **options, &block) }
9
9
  else
10
10
  raise ArgumentError, "no block given"
11
11
  end
@@ -19,7 +19,7 @@ module Enumerable
19
19
  Groupdate::Magic.validate_period(period, options.delete(:permit))
20
20
  send("group_by_#{period}", **options, &block)
21
21
  else
22
- scoping { @klass.group_by_period(period, *args, **options, &block) }
22
+ scoping { klass.group_by_period(period, *args, **options, &block) }
23
23
  end
24
24
  end
25
25
  end
@@ -180,10 +180,10 @@ module Groupdate
180
180
  end
181
181
 
182
182
  def time_zone_support?(relation)
183
- if relation.connection.adapter_name =~ /mysql/i
183
+ if relation.connection.adapter_name.match?(/mysql/i)
184
184
  # need to call klass for Rails < 5.2
185
185
  sql = relation.klass.send(:sanitize_sql_array, ["SELECT CONVERT_TZ(NOW(), '+00:00', ?)", time_zone.tzinfo.name])
186
- !relation.connection.select_all(sql).first.values.first.nil?
186
+ !relation.connection.select_all(sql).to_a.first.values.first.nil?
187
187
  else
188
188
  true
189
189
  end
@@ -238,7 +238,7 @@ module Groupdate
238
238
  def validate_column(column)
239
239
  unless column.is_a?(Symbol) || column.is_a?(Arel::Nodes::SqlLiteral)
240
240
  column = column.to_s
241
- unless /\A\w+(\.\w+)?\z/i.match(column)
241
+ unless /\A\w+(\.\w+)?\z/i.match?(column)
242
242
  raise ActiveRecord::UnknownAttributeReference, "Query method called with non-attribute argument(s): #{column.inspect}. Use Arel.sql() for known-safe values."
243
243
  end
244
244
  end
@@ -257,7 +257,7 @@ module Groupdate
257
257
 
258
258
  # allow any options to keep flexible for future
259
259
  def self.process_result(relation, result, **options)
260
- relation.groupdate_values.reverse.each do |gv|
260
+ relation.groupdate_values.reverse_each do |gv|
261
261
  result = gv.perform(relation, result, default_value: options[:default_value])
262
262
  end
263
263
  result
@@ -1,3 +1,3 @@
1
1
  module Groupdate
2
- VERSION = "6.4.0"
2
+ VERSION = "6.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groupdate
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.0
4
+ version: 6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-14 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.1'
19
+ version: '7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '6.1'
26
+ version: '7'
27
27
  description:
28
28
  email: andrew@ankane.org
29
29
  executables: []
@@ -58,14 +58,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3'
61
+ version: '3.1'
62
62
  required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  requirements: []
68
- rubygems_version: 3.4.10
68
+ rubygems_version: 3.5.16
69
69
  signing_key:
70
70
  specification_version: 4
71
71
  summary: The simplest way to group temporal data