attr-gather 1.3.0 → 1.4.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: edfd2d7479248348551d31676b45459f6f8279f6ca5fdf6ed00540c791de86bd
4
- data.tar.gz: 977ac39f355ded8101507de998a221354ba357bad66528f9efbbb50200d4d731
3
+ metadata.gz: 9bd71ae41d26e56b126cd094b0baa82755c246c059c3149330730e80ff075836
4
+ data.tar.gz: 1ca6c61fa9e9daddcacb558387e2fac8d471108c223a390404ce77b11b2051b7
5
5
  SHA512:
6
- metadata.gz: 958601e4741c30c6707ee6808fb89a258dfa10bab373f623d63fed29faef5eaf0d54d8fecfba4e9949bd16afb7d23bd84aca80aa2d485243de84076e2087284a
7
- data.tar.gz: 11d1ae7d926743a202413647e1fe0f75e3c47966c9444c83a25e706ab8b923fa37ea2cda565042634d0cf6abc900be5fa2e1d3b47c436e6efc950a5d6f3d8fde
6
+ metadata.gz: 96607adf22289a8fc5226ec952e9e80d6694f79cc97bee2100d842c7dd5068b3bc4799d57026876888a432075f6c35d1dfba155069594f945ea002856e5ab7cc
7
+ data.tar.gz: 6ca46ed75fb879de04127ff80c3018a2b086a206ddac8c1e3d311fd71f292642709a09ea0b6dc4285ec19b3ddb1f9493a279894b870052c0c497ca7d9fc974ff
@@ -16,7 +16,7 @@ jobs:
16
16
  bundle install --without=local --jobs 4 --retry 3
17
17
  bundle exec yard
18
18
  - name: Deploy Docs
19
- uses: JamesIves/github-pages-deploy-action@master
19
+ uses: JamesIves/github-pages-deploy-action@4.1.3
20
20
  if: github.ref == 'master'
21
21
  env:
22
22
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attr-gather (1.3.0)
4
+ attr-gather (1.4.0)
5
5
  dry-container (~> 0.7)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # attr-gather
2
2
 
3
3
  ![Actions Status](https://github.com/ianks/attr-gather/workflows/Build%20+%20Test%20+%20Lint/badge.svg)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/b825a3bc37ad6a76e005/maintainability)](https://codeclimate.com/github/ianks/attr-gather/maintainability)
4
5
 
5
6
  A gem for creating workflows that "enhance" entities with extra attributes. At a high level, [attr-gather](https://github.com/ianks/attr-gather) provides a process to fetch information from many data sources (such as third party APIs, legacy databases, etc.) in a fully parallelized fashion.
6
7
 
@@ -12,28 +12,25 @@ module Attr
12
12
  # Initialize a new DeepMerge aggregator
13
13
  #
14
14
  # @param reverse [Boolean] deep merge results in reverse order
15
+ # @param merge_input [Boolean] merge the result with the initial input
15
16
  #
16
17
  # @api private
17
- def initialize(reverse: false, **)
18
+ def initialize(reverse: false, merge_input: true, **)
18
19
  @reverse = reverse
20
+ @merge_input = merge_input
19
21
  super
20
22
  end
21
23
 
22
24
  def call(input, execution_results)
23
25
  execution_results = execution_results.reverse_each if reverse?
24
- initial = unwrap_initial_input(input)
25
26
 
26
- execution_results.reduce(initial) do |memo, res|
27
+ execution_results.reduce(@merge_input ? input : EMPTY_HASH) do |memo, res|
27
28
  deep_merge(memo, unwrap_result(res))
28
29
  end
29
30
  end
30
31
 
31
32
  private
32
33
 
33
- def unwrap_initial_input(input)
34
- input
35
- end
36
-
37
34
  def reverse?
38
35
  @reverse
39
36
  end
@@ -12,17 +12,19 @@ module Attr
12
12
  # Initialize a new DeepMerge aggregator
13
13
  #
14
14
  # @param reverse [Boolean] merge results in reverse order
15
+ # @param merge_input [Boolean] merge the result with the initial input
15
16
  #
16
17
  # @api private
17
- def initialize(reverse: false, **)
18
+ def initialize(reverse: false, merge_input: true, **)
18
19
  @reverse = reverse
20
+ @merge_input = merge_input
19
21
  super
20
22
  end
21
23
 
22
24
  def call(input, execution_results)
23
25
  execution_results = execution_results.reverse_each if reverse?
24
26
 
25
- execution_results.reduce(input) do |memo, res|
27
+ execution_results.reduce(@merge_input ? input : EMPTY_HASH) do |memo, res|
26
28
  memo.merge(unwrap_result(res))
27
29
  end
28
30
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Attr
4
4
  module Gather
5
- VERSION = '1.3.0'
5
+ VERSION = '1.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr-gather
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-03 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -127,7 +127,7 @@ licenses:
127
127
  metadata:
128
128
  homepage_uri: https://github.com/ianks/attr-gather
129
129
  source_code_uri: https://github.com/ianks/attr-gather
130
- post_install_message:
130
+ post_install_message:
131
131
  rdoc_options: []
132
132
  require_paths:
133
133
  - lib
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  version: '0'
144
144
  requirements: []
145
145
  rubygems_version: 3.0.3
146
- signing_key:
146
+ signing_key:
147
147
  specification_version: 4
148
148
  summary: Write a short summary, because RubyGems requires one.
149
149
  test_files: []