attr-gather 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/doc.yml +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/attr/gather/aggregators/deep_merge.rb +4 -7
- data/lib/attr/gather/aggregators/shallow_merge.rb +4 -2
- 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: 9bd71ae41d26e56b126cd094b0baa82755c246c059c3149330730e80ff075836
|
4
|
+
data.tar.gz: 1ca6c61fa9e9daddcacb558387e2fac8d471108c223a390404ce77b11b2051b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96607adf22289a8fc5226ec952e9e80d6694f79cc97bee2100d842c7dd5068b3bc4799d57026876888a432075f6c35d1dfba155069594f945ea002856e5ab7cc
|
7
|
+
data.tar.gz: 6ca46ed75fb879de04127ff80c3018a2b086a206ddac8c1e3d311fd71f292642709a09ea0b6dc4285ec19b3ddb1f9493a279894b870052c0c497ca7d9fc974ff
|
data/.github/workflows/doc.yml
CHANGED
@@ -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@
|
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
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(
|
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
|
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.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:
|
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: []
|