remap 2.1.30 → 2.1.38
Sign up to get free protection for your applications and to get access to all the features.
- 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: 679c50113200cf24ddae26e98109218dfc77ea7e9518c318bad4f4d06b74f547
|
4
|
+
data.tar.gz: 8c34b66e168c6bfbe39ee024766ada836235fd703cf1d11605005e6c6b8fbbb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ae774e517711120aa96459d2c9cb7a5a2bae8994647de1fbe46e47584a031e9de20c2f88402ce0ead68f0a17865c58c602d2eaee53c769fa1487f815ffbd986
|
7
|
+
data.tar.gz: 97a14593c678677d31c68d050622097d8bf94c13d4fa3d578638b007d7fe5eadd5725cfd4b5b2f43752270a9fc52a1af05a714df96e72221709c3ccd5e7c8624
|
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