realize 1.5.0 → 1.6.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 +4 -4
- data/.rubocop.yml +1 -1
- data/.tool-versions +1 -0
- data/CHANGELOG.md +7 -1
- data/README.md +1 -0
- data/lib/realize/collection/join.rb +41 -0
- data/lib/realize/transformers.rb +2 -0
- data/lib/realize/type/boolean.rb +1 -3
- data/lib/realize/version.rb +1 -1
- data/realize.gemspec +3 -3
- metadata +15 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0bb0d8d3479459e62de37d0a70f348873ff1495f3053e8f2d010cfd5e8242f6
|
4
|
+
data.tar.gz: 81b79d68ea2999163daab133a6991073a75807992eff971980b166c9eddfd4cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 005c2fc49cdd4933029ba19d03ffe33308d1e41343ecc58a44ef114ea3ba7df387cb12fba74821eb1c532c75ee21a1bd8549061a454f90bf6e7bb4950135353d
|
7
|
+
data.tar.gz: 98a4548c55826a876dd27b4dce415b0666a196450691e448261d0c78d6c7310f0f7b34ea7a6fca64997fd8984003a3773331c5bcbebee9c4bb2e000b06460199
|
data/.rubocop.yml
CHANGED
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -64,6 +64,7 @@ Here is a list of each built-in transformer, their options, and what their funct
|
|
64
64
|
|
65
65
|
* **r/collection/at_index** [index]: Takes an array (or coerces value to an array) and returns the value at the given index position.
|
66
66
|
* **r/collection/first** []: Takes an array (or coerces value to an array) and returns the value at the first index position.
|
67
|
+
* **r/collection/join** [separator, start_index, end_index]: Takes an array (or coerces value to an array) and returns a new string by concatenating all the elements of the array by a separator character. Can also specifiy which elements to start from and end to that will make up the returned string.
|
67
68
|
* **r/collection/last** []: Takes an array (or coerces value to an array) and returns the value at the last index position.
|
68
69
|
* **r/collection/sort** [key, direction]: Takes an array (or coerces value to an array) and sort it either ascending or descending by some defined key's value.
|
69
70
|
|
@@ -0,0 +1,41 @@
|
|
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 Realize
|
11
|
+
class Collection
|
12
|
+
# Transformer to return a new string by concatenating all the elements of an array
|
13
|
+
# specified by a separator character. The transformer also can be configured to specifiy
|
14
|
+
# which elements to start from and end to that will make up the returned string.
|
15
|
+
class Join
|
16
|
+
include Arrays
|
17
|
+
acts_as_hashable
|
18
|
+
|
19
|
+
DEFAULT_END_INDEX = -1
|
20
|
+
DEFAULT_SEPARATOR = ''
|
21
|
+
DEFAULT_START_INDEX = 0
|
22
|
+
|
23
|
+
attr_reader :separator, :end_index, :start_index
|
24
|
+
|
25
|
+
def initialize(separator: DEFAULT_SEPARATOR, start_index: DEFAULT_START_INDEX,
|
26
|
+
end_index: DEFAULT_END_INDEX)
|
27
|
+
@separator = separator || DEFAULT_SEPARATOR
|
28
|
+
@start_index = start_index || DEFAULT_START_INDEX
|
29
|
+
@end_index = end_index || DEFAULT_END_INDEX
|
30
|
+
|
31
|
+
freeze
|
32
|
+
end
|
33
|
+
|
34
|
+
def transform(_resolver, value, _time, _record)
|
35
|
+
items = array(value)
|
36
|
+
|
37
|
+
(items[start_index..end_index] || []).join(separator)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/realize/transformers.rb
CHANGED
@@ -11,6 +11,7 @@ require_relative 'collection/at_index'
|
|
11
11
|
require_relative 'collection/first'
|
12
12
|
require_relative 'collection/last'
|
13
13
|
require_relative 'collection/sort'
|
14
|
+
require_relative 'collection/join'
|
14
15
|
|
15
16
|
require_relative 'file/basename'
|
16
17
|
require_relative 'file/extname'
|
@@ -58,6 +59,7 @@ module Realize
|
|
58
59
|
register 'r/collection/first', Collection::First
|
59
60
|
register 'r/collection/last', Collection::Last
|
60
61
|
register 'r/collection/sort', Collection::Sort
|
62
|
+
register 'r/collection/join', Collection::Join
|
61
63
|
|
62
64
|
register 'r/file/basename', File::Basename
|
63
65
|
register 'r/file/extname', File::Extname
|
data/lib/realize/type/boolean.rb
CHANGED
data/lib/realize/version.rb
CHANGED
data/realize.gemspec
CHANGED
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
|
|
11
11
|
Derive and transform a value using a configuration-first pipeline.
|
12
12
|
DESCRIPTION
|
13
13
|
|
14
|
-
s.authors = ['Matthew Ruggio', 'Dan Dewar']
|
15
|
-
s.email = ['mruggio@bluemarblepayroll.com', 'ddewar@bluemarblepayroll.com']
|
14
|
+
s.authors = ['Matthew Ruggio', 'Dan Dewar', 'John Bosko']
|
15
|
+
s.email = ['mruggio@bluemarblepayroll.com', 'ddewar@bluemarblepayroll.com', 'jbosko@bluemarblepayroll.com']
|
16
16
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
s.bindir = 'exe'
|
18
18
|
s.executables = []
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_development_dependency('pry', '~>0')
|
37
37
|
s.add_development_dependency('rake', '~> 13')
|
38
38
|
s.add_development_dependency('rspec')
|
39
|
-
s.add_development_dependency('rubocop', '~>1.1')
|
39
|
+
s.add_development_dependency('rubocop', '~>1.1', '>=1.18.1')
|
40
40
|
s.add_development_dependency('simplecov', '~>0.17.0')
|
41
41
|
s.add_development_dependency('simplecov-console', '~>0.6.0')
|
42
42
|
end
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: realize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
- Dan Dewar
|
9
|
-
|
9
|
+
- John Bosko
|
10
|
+
autorequire:
|
10
11
|
bindir: exe
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2021-07-07 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: acts_as_hashable
|
@@ -122,6 +123,9 @@ dependencies:
|
|
122
123
|
- - "~>"
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '1.1'
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 1.18.1
|
125
129
|
type: :development
|
126
130
|
prerelease: false
|
127
131
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -129,6 +133,9 @@ dependencies:
|
|
129
133
|
- - "~>"
|
130
134
|
- !ruby/object:Gem::Version
|
131
135
|
version: '1.1'
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.18.1
|
132
139
|
- !ruby/object:Gem::Dependency
|
133
140
|
name: simplecov
|
134
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +168,7 @@ description: " Derive and transform a value using a configuration-first pipel
|
|
161
168
|
email:
|
162
169
|
- mruggio@bluemarblepayroll.com
|
163
170
|
- ddewar@bluemarblepayroll.com
|
171
|
+
- jbosko@bluemarblepayroll.com
|
164
172
|
executables: []
|
165
173
|
extensions: []
|
166
174
|
extra_rdoc_files: []
|
@@ -169,6 +177,7 @@ files:
|
|
169
177
|
- ".gitignore"
|
170
178
|
- ".rubocop.yml"
|
171
179
|
- ".ruby-version"
|
180
|
+
- ".tool-versions"
|
172
181
|
- ".travis.yml"
|
173
182
|
- CHANGELOG.md
|
174
183
|
- CODE_OF_CONDUCT.md
|
@@ -183,6 +192,7 @@ files:
|
|
183
192
|
- lib/realize/arrays.rb
|
184
193
|
- lib/realize/collection/at_index.rb
|
185
194
|
- lib/realize/collection/first.rb
|
195
|
+
- lib/realize/collection/join.rb
|
186
196
|
- lib/realize/collection/last.rb
|
187
197
|
- lib/realize/collection/sort.rb
|
188
198
|
- lib/realize/collection/sort/direction.rb
|
@@ -229,7 +239,7 @@ metadata:
|
|
229
239
|
documentation_uri: https://www.rubydoc.info/gems/realize
|
230
240
|
homepage_uri: https://github.com/bluemarblepayroll/realize
|
231
241
|
source_code_uri: https://github.com/bluemarblepayroll/realize
|
232
|
-
post_install_message:
|
242
|
+
post_install_message:
|
233
243
|
rdoc_options: []
|
234
244
|
require_paths:
|
235
245
|
- lib
|
@@ -245,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
255
|
version: '0'
|
246
256
|
requirements: []
|
247
257
|
rubygems_version: 3.0.3
|
248
|
-
signing_key:
|
258
|
+
signing_key:
|
249
259
|
specification_version: 4
|
250
260
|
summary: Configurable Data Transformation Pipeline
|
251
261
|
test_files: []
|