forest_admin_datasource_toolkit 1.0.0.pre.beta.36 → 1.0.0.pre.beta.37

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: d3d8c5b1c1274bd495e86cfae6e4f2c0b8ee1a4cc4655f8e7472f61b3fc7fc48
4
- data.tar.gz: afd39e3f506770138dc50cf4e361b4164b4b9014d678e3ba22c5a57e90ba86d6
3
+ metadata.gz: 5cc39af80f6b4a47d2fccdfcaa3dce33c9e28ac3169ade1234fba62bd82277a3
4
+ data.tar.gz: 599453a69d43907070c29d8518d0c3848e5c9fe8b1ad19db65ac568968ccbfee
5
5
  SHA512:
6
- metadata.gz: 387ac362e95d5bd809fe2790e20c01c4bbec05d41266579bdb7a84863d825d7d9b25116ae4a44dde377f2779034623561a684f14679c74fa96d9523aaf32ed18
7
- data.tar.gz: dba0eab2b216fcd3113e991c08a82dbfe18b0dcb3476a4f61f23ba3ebad2955482ed2fbbb604da5cf3744b6cadce6e550245c2b8e982f7871bf708401046d264
6
+ metadata.gz: a5d0df0a415d47da310ed2db84ae77c5b9ecd17d7d08d9f74054f9a6f37ce98e9c3dbd30ec01d22839cadd949cf6c85fe745168128e3ed37687f3ee09ae77b53
7
+ data.tar.gz: 60a679a3db3cc077ceaff65619434e9b62845761b6f008884ee36bd886d9806b9cf7891c0dd3ed54a5cc85e55772d15b7314526961204c04d5f295f79169e144
@@ -6,7 +6,8 @@ module ForestAdminDatasourceToolkit
6
6
  module Query
7
7
  class Aggregation
8
8
  include ForestAdminDatasourceToolkit::Exceptions
9
- attr_reader :operation, :field, :groups
9
+ attr_reader :operation
10
+ attr_accessor :groups, :field
10
11
 
11
12
  def initialize(operation:, field: nil, groups: [])
12
13
  validate(operation)
@@ -32,12 +33,12 @@ module ForestAdminDatasourceToolkit
32
33
  Projection.new(aggregate_fields)
33
34
  end
34
35
 
35
- def replace_fields(handler)
36
+ def replace_fields
36
37
  result = clone
37
- result.field = handler.call(result.field) if result.field
38
+ result.field = yield(result.field) if result.field
38
39
  result.groups = result.groups.map do |group|
39
40
  {
40
- field: handler.call(group[:field]),
41
+ field: yield(group[:field]),
41
42
  operation: group[:operation] || nil
42
43
  }
43
44
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceToolkit
2
- VERSION = "1.0.0-beta.36"
2
+ VERSION = "1.0.0-beta.37"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.36
4
+ version: 1.0.0.pre.beta.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu