groupdate 6.3.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: 3a4126fc8a5f5889756f5dafbe8a2aad2ec9e1f02e3ecebf28087aaa658329e9
4
- data.tar.gz: f449b78239463cb3eb30cb0f1e07010b0a9826beaaafa6d29c07568f8af6781c
3
+ metadata.gz: 1ef9a0ee3177e94a0e797036221d6e33b124e41f7f867fe8b0904a24bd7cf741
4
+ data.tar.gz: 73ef98496e157ba77bc8afb226c625dc9f117347b676eb39d767f4d55023309a
5
5
  SHA512:
6
- metadata.gz: 85907ac131fdbeaaaa66dc220f933f935deae5d97dddb1ed9fcfef06ff9cbc55cfdd01ea3447bb659bff1809a415e94a19c00008dea3c5e94fab8c2403c74bf8
7
- data.tar.gz: d069f3f9b5ff8cbd5f2aba12f04d9921e017d541b0efe043679c514593827db0e2a6150cc18ec6cc4f33fba869c1ca263776e4c00bd91311ef2c69e0cafa27b2
6
+ metadata.gz: b38cacba795f7f0e0430fa1c1935b5e2aa6556926b70533966e912f5a7110291bb2a5f6542c37c6fd7bb996cf973db5241eb7299a8c664e327026fb702cf191a
7
+ data.tar.gz: 393f55d1892c6b65cbe51608aaee4f7e1f2a06067637196a1d6ed82e69434ebb10169553308f21cb8738d06513e19eb505657ccea8d47544da85ca3c77eff02d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
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
+
6
+ ## 6.4.0 (2023-09-13)
7
+
8
+ - Added support for Trilogy
9
+
1
10
  ## 6.3.0 (2023-07-02)
2
11
 
3
12
  - Dropped support for Ruby < 3 and Rails < 6.1
@@ -169,7 +178,7 @@ Breaking changes
169
178
  - Added `default_value` option
170
179
  - Accept symbol for `format` option
171
180
  - Raise `ArgumentError` if no field specified
172
- - Added support for ActiveRecord 5 beta
181
+ - Added support for Active Record 5 beta
173
182
 
174
183
  ## 2.5.0 (2015-09-29)
175
184
 
@@ -183,18 +192,18 @@ Breaking changes
183
192
  - Added `carry_forward` option
184
193
  - Added `series: false` option for arrays and hashes
185
194
  - Fixed issue w/ Brasilia Summer Time
186
- - Fixed issues w/ ActiveRecord 4.2
195
+ - Fixed issues w/ Active Record 4.2
187
196
 
188
197
  ## 2.3.0 (2014-08-31)
189
198
 
190
- - Raise error when ActiveRecord::Base.default_timezone is not `:utc`
199
+ - Raise error when `ActiveRecord::Base.default_timezone` is not `:utc`
191
200
  - Added `day_of_month`
192
201
  - Added `month_of_year`
193
202
  - Do not quote column name
194
203
 
195
204
  ## 2.2.1 (2014-06-23)
196
205
 
197
- - Fixed ActiveRecord 3 associations
206
+ - Fixed Active Record 3 associations
198
207
 
199
208
  ## 2.2.0 (2014-06-22)
200
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.3.0"
2
+ VERSION = "6.5.0"
3
3
  end
data/lib/groupdate.rb CHANGED
@@ -43,7 +43,7 @@ module Groupdate
43
43
  end
44
44
  end
45
45
 
46
- Groupdate.register_adapter ["Mysql2", "Mysql2Spatial", "Mysql2Rgeo"], Groupdate::Adapters::MySQLAdapter
46
+ Groupdate.register_adapter ["Mysql2", "Mysql2Spatial", "Mysql2Rgeo", "Trilogy"], Groupdate::Adapters::MySQLAdapter
47
47
  Groupdate.register_adapter ["PostgreSQL", "PostGIS", "Redshift"], Groupdate::Adapters::PostgreSQLAdapter
48
48
  Groupdate.register_adapter "SQLite", Groupdate::Adapters::SQLiteAdapter
49
49
 
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.3.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-07-02 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