calculate-all 0.3.0 → 0.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: 0ccade1f3bc4b62c2842ef335e27d0c7a11a90fa18e90f3b1260bb572243a4b6
4
- data.tar.gz: 9d8dd96e03c6155f828d5fb586a652e9f0d94a5cbb21cfb41fc3c5022772501c
3
+ metadata.gz: f15872602a35e41a3619150837e69840e82da1d2a42bd058a7c6986092024a97
4
+ data.tar.gz: f3665c7b64a083c5f24fd861e6ef22a5dde177e4a68eab9638449e26f89e2dc7
5
5
  SHA512:
6
- metadata.gz: df3d5a6c997473a188f824f865951c05ed8d054758906c6647d4c868a55a37cb55cc0c5981b0bbe4106214d386a03c11fcb41211498c58b7f022a779b265d192
7
- data.tar.gz: ca3c3d75e899ff84f85886aeb649f86cc81f0612476297102036a7d991ed872819381c9505f7ed34b3713aed508960f71d8377ac986d92599f9bf585fe493d78
6
+ metadata.gz: 5d7ed4f530ff56be9378644b209add40b415bedf363425599a10a7d3fc14b1d0cb0920dd6744f5c334ae83f0ec9296b161d8bc387a2e4f93c1a849d7764e571a
7
+ data.tar.gz: 164b353805bf7fdd12e10087186c20a805231f68922c4d46a42e7c8f02307165d36592cbcf0c67d2a27f61e6dbb43c9cd7ab2934b9a64112ef239cf4e50edf05
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.1
2
+
3
+ * Fix some arguments exceptions
4
+
1
5
  ## 0.3.0
2
6
 
3
7
  * Allow expression shortcuts as attribute values too for renaming
data/Gemfile CHANGED
@@ -11,6 +11,7 @@ gem "pg"
11
11
  gem "mysql2"
12
12
  gem "sqlite3", ">= 2.1"
13
13
 
14
+ gem "irb"
14
15
  gem "ostruct"
15
16
 
16
17
  gem "standardrb", require: false
data/README.md CHANGED
@@ -78,7 +78,7 @@ or arbitrary symbols and keyword arguments with SQL snippets, aggregate function
78
78
  )
79
79
  ```
80
80
 
81
- For convenience, `calculate_all(:count, :avg_column)` is the same as `caculate(count: :count, avg_column: :avg_column)`
81
+ For convenience, `calculate_all(:count, :avg_column)` is the same as `calculate_all(count: :count, avg_column: :avg_column)`
82
82
 
83
83
  Here's a cheatsheet of recognized shortcuts:
84
84
 
@@ -139,7 +139,7 @@ with aggregate functions.
139
139
  ```ruby
140
140
  Order.group(:payment_method).calculate_all('CAST(SUM(price) AS decimal) / COUNT(DISTINCT user_id)')
141
141
  # => {
142
- # "card" => 0.524e3
142
+ # "card" => 0.524e3,
143
143
  # "cash" => 0.132e3
144
144
  # }
145
145
  ```
@@ -186,7 +186,7 @@ Order.group_by_year(:created_at).calculate_all(*Stats.members, &Stats.method(:ne
186
186
  # => {
187
187
  # Wed, 01 Jan 2014 => #<data Stats count=2, max_price=700>,
188
188
  # Thu, 01 Jan 2015 => #<data Stats count=0, max_price=nil>,
189
- # Fri, 01 Jan 2016 => #<data Stats count=3, max_price800>
189
+ # Fri, 01 Jan 2016 => #<data Stats count=3, max_price=800>
190
190
  # }
191
191
  ```
192
192
 
@@ -227,7 +227,7 @@ Or install it yourself as:
227
227
 
228
228
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
229
229
  Run `BUNDLE_GEMFILE=gemfiles/activerecord60.gemfile bundle` then `BUNDLE_GEMFILE=gemfiles/activerecord60.gemfile rake`
230
- to test agains specific active record version.
230
+ to test against specific active record version.
231
231
 
232
232
  To experiment you can load a test database and jump to IRB with
233
233
 
@@ -1,3 +1,3 @@
1
1
  module CalculateAll
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/calculate-all.rb CHANGED
@@ -27,8 +27,8 @@ module CalculateAll
27
27
 
28
28
  results = {}
29
29
  pluck(*columns).each do |row|
30
- # If pluck called with with a single argument
31
- # it will return an array of sclars instead of array of arrays
30
+ # If pluck called with a single argument
31
+ # it will return an array of scalars instead of array of arrays
32
32
  row = [row] if columns.size == 1
33
33
 
34
34
  key = if group_values.size == 0
@@ -51,7 +51,7 @@ module CalculateAll
51
51
  # Additional groupdate magic of filling empty periods with defaults
52
52
  if defined?(Groupdate.process_result)
53
53
  # Since that hash is the same instance for every backfilled row, at least
54
- # freeze it to prevent surprize modifications across multiple rows in the calling code.
54
+ # freeze it to prevent surprise modifications across multiple rows in the calling code.
55
55
  default_value = return_plain_values ? nil : {}.freeze
56
56
  results = Groupdate.process_result(self, results, default_value: default_value)
57
57
  end
@@ -97,7 +97,7 @@ module CalculateAll
97
97
  when /^(\w+)_minimum$/, /^minimum_(\w+)$/
98
98
  "MIN(#{$1})"
99
99
  else
100
- raise ArgumentError, "Can't recognize expression shortcut #{key}"
100
+ raise ArgumentError, "Can't recognize expression shortcut #{shortcut}"
101
101
  end
102
102
  end
103
103
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calculate-all
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Trofimenko
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-05-18 00:00:00.000000000 Z
10
+ date: 2025-05-19 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport