remap 2.1.33 → 2.2.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/lib/remap/path/input.rb +5 -4
- data/lib/remap/path/output.rb +2 -2
- data/lib/remap/path.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4668cf907db4bc78c0cc78119c0c81ae14240d620b11ea773c76791263538c4
|
4
|
+
data.tar.gz: 1bf6c041a5c062080ae6baf7ac0bf73962a335ff5aa7ee8cabdab38fb548dfd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b7836221d77a239ff624912ecc4b2b17e1916ced7214242a8a32f69ab657ee02e0190f9be29669a3569b29be43ed0c3e36c6fcf2c914ddc37c30366bd2400c5
|
7
|
+
data.tar.gz: a01e83234f451c7ec81f91f169ab092daa43125e8df5a513f2f721a9acff7dedd985869147b79647b9a2b38f4a0eaea337e76505438c0362e4e94ece1d40b889
|
data/lib/remap/path/input.rb
CHANGED
@@ -16,19 +16,20 @@ module Remap
|
|
16
16
|
# end
|
17
17
|
class Input < Unit
|
18
18
|
# @return [Array<Selector>]
|
19
|
-
attribute :
|
19
|
+
attribute :selectors, [Selector]
|
20
20
|
|
21
|
-
# Selects the value at the path {#segments}
|
22
|
-
#
|
23
21
|
# @param state [State]
|
24
22
|
#
|
23
|
+
# @yieldparam [State]
|
24
|
+
# @yieldreturn [State]
|
25
|
+
#
|
25
26
|
# @return [State]
|
26
27
|
def call(state, &iterator)
|
27
28
|
unless block_given?
|
28
29
|
raise ArgumentError, "Input path requires an iterator block"
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
+
selectors.reverse.reduce(iterator) do |inner_iterator, selector|
|
32
33
|
-> inner_state { selector.call(inner_state, &inner_iterator) }
|
33
34
|
end.call(state)
|
34
35
|
end
|
data/lib/remap/path/output.rb
CHANGED
@@ -13,12 +13,12 @@ module Remap
|
|
13
13
|
#
|
14
14
|
# result.fetch(:value) # => { a: { b: { c: "A" } } }
|
15
15
|
class Output < Unit
|
16
|
-
attribute :
|
16
|
+
attribute :selectors, [Types::Key]
|
17
17
|
|
18
18
|
# @return [State]
|
19
19
|
def call(state)
|
20
20
|
state.fmap do |value|
|
21
|
-
|
21
|
+
selectors.hide(value)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/remap/path.rb
CHANGED