attr-gather 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -1
- data/lib/attr/gather/aggregators/deep_merge.rb +7 -4
- data/lib/attr/gather/aggregators/shallow_merge.rb +2 -4
- data/lib/attr/gather/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edfd2d7479248348551d31676b45459f6f8279f6ca5fdf6ed00540c791de86bd
|
4
|
+
data.tar.gz: 977ac39f355ded8101507de998a221354ba357bad66528f9efbbb50200d4d731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 958601e4741c30c6707ee6808fb89a258dfa10bab373f623d63fed29faef5eaf0d54d8fecfba4e9949bd16afb7d23bd84aca80aa2d485243de84076e2087284a
|
7
|
+
data.tar.gz: 11d1ae7d926743a202413647e1fe0f75e3c47966c9444c83a25e706ab8b923fa37ea2cda565042634d0cf6abc900be5fa2e1d3b47c436e6efc950a5d6f3d8fde
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
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)
|
5
4
|
|
6
5
|
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.
|
7
6
|
|
@@ -12,25 +12,28 @@ 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
|
16
15
|
#
|
17
16
|
# @api private
|
18
|
-
def initialize(reverse: false,
|
17
|
+
def initialize(reverse: false, **)
|
19
18
|
@reverse = reverse
|
20
|
-
@merge_input = merge_input
|
21
19
|
super
|
22
20
|
end
|
23
21
|
|
24
22
|
def call(input, execution_results)
|
25
23
|
execution_results = execution_results.reverse_each if reverse?
|
24
|
+
initial = unwrap_initial_input(input)
|
26
25
|
|
27
|
-
execution_results.reduce(
|
26
|
+
execution_results.reduce(initial) do |memo, res|
|
28
27
|
deep_merge(memo, unwrap_result(res))
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
31
|
private
|
33
32
|
|
33
|
+
def unwrap_initial_input(input)
|
34
|
+
input
|
35
|
+
end
|
36
|
+
|
34
37
|
def reverse?
|
35
38
|
@reverse
|
36
39
|
end
|
@@ -12,19 +12,17 @@ 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
|
16
15
|
#
|
17
16
|
# @api private
|
18
|
-
def initialize(reverse: false,
|
17
|
+
def initialize(reverse: false, **)
|
19
18
|
@reverse = reverse
|
20
|
-
@merge_input = merge_input
|
21
19
|
super
|
22
20
|
end
|
23
21
|
|
24
22
|
def call(input, execution_results)
|
25
23
|
execution_results = execution_results.reverse_each if reverse?
|
26
24
|
|
27
|
-
execution_results.reduce(
|
25
|
+
execution_results.reduce(input) do |memo, res|
|
28
26
|
memo.merge(unwrap_result(res))
|
29
27
|
end
|
30
28
|
end
|
data/lib/attr/gather/version.rb
CHANGED
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.
|
4
|
+
version: 1.3.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:
|
11
|
+
date: 2020-12-03 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: []
|