burner 1.0.0.pre.alpha.11 → 1.0.0.pre.alpha.13

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: adf7e5e1ea0c19d59b6edcbb1c5073e25f533bf32076df4ec7d9122edc852958
4
- data.tar.gz: 40009afdb93c5ee3971513971dd47a8f416acd04b33eb0c8e9720806cce4a515
3
+ metadata.gz: d682634e7c0c8b850b98d80a33e4e44012a3f7ae058b72e3c828830d7e177a0a
4
+ data.tar.gz: afc1daecbec70a6ec88f19ab11ea92f93f28a7dd8bc8ea4821cb6a222db3f824
5
5
  SHA512:
6
- metadata.gz: cf255e3021e975451354a3d9537b464ffc61843c59b780ceace9dc6be04e4e2499f5d874aa905608ed3c4b60c4989e6bb3c8cccd2116e8286ca045ea4202bea7
7
- data.tar.gz: 569a44eb9a5915d946b4de3038ead60094b170481583ea6974391eedaba209162df03883757b917b2e9c3ed3be6d8c2f80f64f43e6420d5fbc2d711eedc81a8c
6
+ metadata.gz: d75499b61c0b30b4882fb8cf10c74ea2cd0dfa8562824bf3a0a61c3311b78808eaeb5e0dfc1db1faa81400a23a998e4dd6b37ba35ad170ec2945c8708804d7c7
7
+ data.tar.gz: 42e5b5d6fead52793eefa7ef6f41423254e870e0fd319d7aad8b011c88c8048bbaec78cac79d0acdeed98f446777014b46e419ed86e39ea0f7fd9f888c786a4d
data/README.md CHANGED
@@ -234,6 +234,7 @@ This library only ships with very basic, rudimentary jobs that are meant to just
234
234
  #### Collection
235
235
 
236
236
  * **b/collection/arrays_to_objects** [mappings, register]: Convert an array of arrays to an array of objects.
237
+ * **b/collection/concatenate** [from_registers, to_register]: Concatenate each from_register's value and place the newly concatenated array into the to_register. Note: this does not do any deep copying and should be assumed it is shallow copying all objects.
237
238
  * **b/collection/graph** [config, key, register]: Use [Hashematics](https://github.com/bluemarblepayroll/hashematics) to turn a flat array of objects into a deeply nested object tree.
238
239
  * **b/collection/objects_to_arrays** [mappings, register]: Convert an array of objects to an array of arrays.
239
240
  * **b/collection/shift** [amount, register]: Remove the first N number of elements from an array.
@@ -260,11 +261,15 @@ This library only ships with very basic, rudimentary jobs that are meant to just
260
261
  * **b/serialize/json** [register]: Convert value to JSON.
261
262
  * **b/serialize/yaml** [register]: Convert value to YAML.
262
263
 
264
+ #### Value
265
+
266
+ * **b/value/copy** [from_register, to_register]: Copy from_register's value into the to_register. Note: this does not do any deep copying and should be assumed it is shallow copying all objects.
267
+ * **b/value/static** [register, value]: Set the value to any arbitrary value.
268
+
263
269
  #### General
264
270
 
265
271
  * **b/echo** [message]: Write a message to the output. The message parameter can be interpolated using `Payload#params`.
266
272
  * **b/nothing** []: Do nothing.
267
- * **b/set** [register, value]: Set the value to any arbitrary value.
268
273
  * **b/sleep** [seconds]: Sleep the thread for X number of seconds.
269
274
 
270
275
  Notes:
@@ -20,10 +20,10 @@ module Burner
20
20
  # string then the nothing job will be used.
21
21
  register 'b/echo', Library::Echo
22
22
  register 'b/nothing', '', Library::Nothing
23
- register 'b/set_value', Library::SetValue
24
23
  register 'b/sleep', Library::Sleep
25
24
 
26
25
  register 'b/collection/arrays_to_objects', Library::Collection::ArraysToObjects
26
+ register 'b/collection/concatenate', Library::Collection::Concatenate
27
27
  register 'b/collection/graph', Library::Collection::Graph
28
28
  register 'b/collection/objects_to_arrays', Library::Collection::ObjectsToArrays
29
29
  register 'b/collection/shift', Library::Collection::Shift
@@ -43,5 +43,8 @@ module Burner
43
43
  register 'b/serialize/csv', Library::Serialize::Csv
44
44
  register 'b/serialize/json', Library::Serialize::Json
45
45
  register 'b/serialize/yaml', Library::Serialize::Yaml
46
+
47
+ register 'b/value/copy', Library::Value::Copy
48
+ register 'b/value/static', Library::Value::Static
46
49
  end
47
50
  end
@@ -11,10 +11,10 @@ require_relative 'job_with_register'
11
11
 
12
12
  require_relative 'library/echo'
13
13
  require_relative 'library/nothing'
14
- require_relative 'library/set_value'
15
14
  require_relative 'library/sleep'
16
15
 
17
16
  require_relative 'library/collection/arrays_to_objects'
17
+ require_relative 'library/collection/concatenate'
18
18
  require_relative 'library/collection/graph'
19
19
  require_relative 'library/collection/objects_to_arrays'
20
20
  require_relative 'library/collection/shift'
@@ -34,3 +34,6 @@ require_relative 'library/io/write'
34
34
  require_relative 'library/serialize/csv'
35
35
  require_relative 'library/serialize/json'
36
36
  require_relative 'library/serialize/yaml'
37
+
38
+ require_relative 'library/value/copy'
39
+ require_relative 'library/value/static'
@@ -23,7 +23,7 @@ module Burner
23
23
  # jobs: [
24
24
  # {
25
25
  # name: 'set',
26
- # type: 'b/set_value',
26
+ # type: 'b/value/static',
27
27
  # value: [
28
28
  # [1, 'funky']
29
29
  # ]
@@ -0,0 +1,42 @@
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
+ # Take the list of from_registers and concatenate each of their values together.
14
+ # Each from_value will be coerced into an array if it not an array.
15
+ #
16
+ # Expected Payload[from_register] input: array of objects.
17
+ # Payload[to_register] output: An array of objects.
18
+ class Concatenate < Job
19
+ attr_reader :from_registers, :to_register
20
+
21
+ def initialize(name:, from_registers: [], to_register: '')
22
+ super(name: name)
23
+
24
+ @from_registers = Array(from_registers)
25
+ @to_register = to_register.to_s
26
+
27
+ freeze
28
+ end
29
+
30
+ def perform(output, payload)
31
+ output.detail("Concatenating registers: '#{from_registers}' to: '#{to_register}'")
32
+
33
+ payload[to_register] = from_registers.each_with_object([]) do |from_register, memo|
34
+ from_register_value = array(payload[from_register])
35
+
36
+ memo.concat(from_register_value)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -24,7 +24,7 @@ module Burner
24
24
  # jobs: [
25
25
  # {
26
26
  # name: 'set',
27
- # type: 'b/set_value',
27
+ # type: 'b/value/static',
28
28
  # value: [
29
29
  # { 'id' => 1, 'name' => 'funky' }
30
30
  # ],
@@ -0,0 +1,39 @@
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 Value
13
+ # Copy one value in a register to another. Note that this does *not* perform any type of
14
+ # deep copy, it simply points one register's value to another. If you decide to later mutate
15
+ # one register, you are *not* guaranteed to not mutate the other.
16
+ #
17
+ # Expected Payload[from_register] input: anything.
18
+ # Payload[to_register] output: whatever value was specified in the from_register.
19
+ class Copy < Job
20
+ attr_reader :from_register, :to_register
21
+
22
+ def initialize(name:, to_register: '', from_register: '')
23
+ super(name: name)
24
+
25
+ @from_register = from_register.to_s
26
+ @to_register = to_register.to_s
27
+
28
+ freeze
29
+ end
30
+
31
+ def perform(output, payload)
32
+ output.detail("Copying register: '#{from_register}' to: '#{to_register}'")
33
+
34
+ payload[to_register] = payload[from_register]
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,34 @@
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 Value
13
+ # Arbitrarily set the value of a register.
14
+ #
15
+ # Expected Payload[register] input: anything.
16
+ # Payload[register] output: whatever value was specified in this job.
17
+ class Static < JobWithRegister
18
+ attr_reader :value
19
+
20
+ def initialize(name:, register: '', value: nil)
21
+ super(name: name, register: register)
22
+
23
+ @value = value
24
+
25
+ freeze
26
+ end
27
+
28
+ def perform(_output, payload)
29
+ payload[register] = value
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Burner
11
- VERSION = '1.0.0-alpha.11'
11
+ VERSION = '1.0.0-alpha.13'
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.0.0.pre.alpha.11
4
+ version: 1.0.0.pre.alpha.13
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-10-27 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -225,6 +225,7 @@ files:
225
225
  - lib/burner/jobs.rb
226
226
  - lib/burner/library.rb
227
227
  - lib/burner/library/collection/arrays_to_objects.rb
228
+ - lib/burner/library/collection/concatenate.rb
228
229
  - lib/burner/library/collection/graph.rb
229
230
  - lib/burner/library/collection/objects_to_arrays.rb
230
231
  - lib/burner/library/collection/shift.rb
@@ -244,8 +245,9 @@ files:
244
245
  - lib/burner/library/serialize/csv.rb
245
246
  - lib/burner/library/serialize/json.rb
246
247
  - lib/burner/library/serialize/yaml.rb
247
- - lib/burner/library/set_value.rb
248
248
  - lib/burner/library/sleep.rb
249
+ - lib/burner/library/value/copy.rb
250
+ - lib/burner/library/value/static.rb
249
251
  - lib/burner/modeling.rb
250
252
  - lib/burner/modeling/attribute.rb
251
253
  - lib/burner/modeling/attribute_renderer.rb
@@ -1,32 +0,0 @@
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
- # Arbitrarily set value
13
- #
14
- # Expected Payload[register] input: anything.
15
- # Payload[register] output: whatever value was specified in this job.
16
- class SetValue < JobWithRegister
17
- attr_reader :value
18
-
19
- def initialize(name:, register: '', value: nil)
20
- super(name: name, register: register)
21
-
22
- @value = value
23
-
24
- freeze
25
- end
26
-
27
- def perform(_output, payload)
28
- payload[register] = value
29
- end
30
- end
31
- end
32
- end