burner 1.4.0 → 1.5.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 708bae8cd70ee165a49a692ede631830ba30e378d002c6dd1b986262def154f9
4
- data.tar.gz: bb11da5222c638d97cf33e39633c4f7fca7c6e0a6ccf2cf75c24844d3b3d6159
3
+ metadata.gz: 5cbb761b5c317ea13a380ac7c96fe48846a5194d628c425fa0305c59738ce74e
4
+ data.tar.gz: d8d178a3c4ae9ea142610a4f341608c29e28cc8e9ad76edd10031e0983558178
5
5
  SHA512:
6
- metadata.gz: 4b15fff4b6c137d9d2d004181da58d8f4a2864605b3b286685449f8b8dd63bde6b89335cd4a619dc15bc57b261772f90c0eacd7679e13a16ed5897da75d66594
7
- data.tar.gz: 2fe52efc1b645028b97332b0d91f919408fccab68a1474e6406ee0d1ac324d1b12d3cd518ed1817203307677611bcb76e13c00423c417faa86b2c3e3754f68a7
6
+ metadata.gz: bc546faf0d6feb8828287b5c9f8893d3f21e29edb2ec638a2839e67bc05f9b5de8bbfb3ad9a3459bb4557fe052ee874f917aefbf3ad5b1829fcc499f1a4f9979
7
+ data.tar.gz: 778df0850ef5ef87a843409694577f8a75de9a541d6d32830780eec9add582bf95af932c01ec8fe17f3d29ba87d410fce8d0ad498049ca217cff7d5cb278a623
@@ -1,3 +1,9 @@
1
+
2
+ # 1.5.0 (TBD)
3
+
4
+ Added Jobs:
5
+
6
+ * b/collection/zip
1
7
  # 1.4.0 (December 17th, 2020)
2
8
 
3
9
  Additions:
data/README.md CHANGED
@@ -227,6 +227,7 @@ This library only ships with very basic, rudimentary jobs that are meant to just
227
227
  * **b/collection/unpivot** [pivot_set, register]: Take an array of objects and unpivot specific sets of keys into rows. Under the hood it uses [HashMath's Unpivot class](https://github.com/bluemarblepayroll/hash_math#unpivot-hash-key-coalescence-and-row-extrapolation).
228
228
  * **b/collection/validate** [invalid_register, join_char, message_key, register, separator, validations]: Take an array of objects, run it through each declared validator, and split the objects into two registers. The valid objects will be split into the current register while the invalid ones will go into the invalid_register as declared. Optional arguments, join_char and message_key, help determine the compiled error messages. The separator option can be utilized to use dot-notation for validating keys. See each validation's options by viewing their classes within the `lib/modeling/validations` directory.
229
229
  * **b/collection/values** [include_keys, register]: Take an array of objects and call `#values` on each object. If include_keys is true (it is false by default), then call `#keys` on the first object and inject that as a "header" object.
230
+ * **b/collection/zip** [base_register, register, with_register]: Combines `base_register` and `with_register`s' data to form one single array in `register`. It will combine each element, positionally in each array to form the final array. For example: ['hello', 'bugs'] + ['world', 'bunny'] => [['hello', 'world'], ['bugs', 'bunny']]
230
231
 
231
232
  #### Compression
232
233
 
@@ -34,6 +34,7 @@ module Burner
34
34
  register 'b/collection/unpivot', Library::Collection::Unpivot
35
35
  register 'b/collection/values', Library::Collection::Values
36
36
  register 'b/collection/validate', Library::Collection::Validate
37
+ register 'b/collection/zip', Library::Collection::Zip
37
38
 
38
39
  register 'b/compress/row_reader', Library::Compress::RowReader
39
40
 
@@ -25,6 +25,7 @@ require_relative 'library/collection/transform'
25
25
  require_relative 'library/collection/unpivot'
26
26
  require_relative 'library/collection/validate'
27
27
  require_relative 'library/collection/values'
28
+ require_relative 'library/collection/zip'
28
29
 
29
30
  require_relative 'library/compress/row_reader'
30
31
 
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Burner
11
+ module Library
12
+ module Collection
13
+ # This job can take two arrays and coalesces them by index. For example:
14
+ #
15
+ # input:
16
+ # base_register: [ 'hello', 'bugs' ]
17
+ # with_register: [ 'world', 'bunny' ]
18
+ # output:
19
+ # register: [ ['hello', 'world'], ['bugs', 'bunny'] ]
20
+ #
21
+ # Expected Payload[base_register] input: array of objects.
22
+ # Expected Payload[with_register] input: array of objects.
23
+ # Payload[register] output: An array of two-dimensional arrays.
24
+ class Zip < JobWithRegister
25
+ attr_reader :base_register, :with_register
26
+
27
+ def initialize(
28
+ name:,
29
+ with_register:,
30
+ base_register: DEFAULT_REGISTER,
31
+ register: DEFAULT_REGISTER
32
+ )
33
+ super(name: name, register: register)
34
+
35
+ @base_register = base_register.to_s
36
+ @with_register = with_register.to_s
37
+
38
+ freeze
39
+ end
40
+
41
+ def perform(output, payload)
42
+ base_data = array(payload[base_register])
43
+ with_data = array(payload[with_register])
44
+
45
+ output.detail("Combining register: #{base_register} (#{base_data.length} record(s))")
46
+ output.detail("With register: #{with_register} (#{with_data.length} record(s))")
47
+
48
+ payload[register] = base_data.zip(with_data)
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Burner
11
- VERSION = '1.4.0'
11
+ VERSION = '1.5.0-alpha'
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-17 00:00:00.000000000 Z
11
+ date: 2020-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -252,6 +252,7 @@ files:
252
252
  - lib/burner/library/collection/unpivot.rb
253
253
  - lib/burner/library/collection/validate.rb
254
254
  - lib/burner/library/collection/values.rb
255
+ - lib/burner/library/collection/zip.rb
255
256
  - lib/burner/library/compress/row_reader.rb
256
257
  - lib/burner/library/deserialize/csv.rb
257
258
  - lib/burner/library/deserialize/json.rb
@@ -309,9 +310,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
310
  version: '2.5'
310
311
  required_rubygems_version: !ruby/object:Gem::Requirement
311
312
  requirements:
312
- - - ">="
313
+ - - ">"
313
314
  - !ruby/object:Gem::Version
314
- version: '0'
315
+ version: 1.3.1
315
316
  requirements: []
316
317
  rubygems_version: 3.0.3
317
318
  signing_key: