remap 2.1.33 → 2.1.34
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: e6c44d34240da36e531e1335ad3530b6cc326e3a70636459c38fdb2fbe36269d
|
4
|
+
data.tar.gz: 4a8670a444ba92727097e34fe7c3d6ea49bab097b75bb6bb6b7ea8a573d917e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5335ced0a424fcb64fe7359db53fbab49537d3bfc81e4882c981576a092a8de5f79c186c96e72e03c1d473e600efd3b2f6df3ff964b925eba730677bde8411c8
|
7
|
+
data.tar.gz: e4116e42c52851aa73dbcb45b775acbb57b39f30d7707df5f223a32bd16464ab29949c495c54ee6112a49098272fb7456679ab17b040f4351dbc5caefe3fc106
|
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