remap 2.2.38 → 2.2.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/remap/compiler.rb +10 -10
- data/lib/remap/selector/index.rb +1 -1
- data/lib/remap/static/option.rb +5 -5
- 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: 63e86ddbef0fd288ba558768cd947639c566f4db3789b19163c0ead17782635f
|
4
|
+
data.tar.gz: 2e3359e5d2ca7f78e1c2540c9289d489d132be91456493eaf2e4c6f8542b9b4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2f4134ae97e0e00e9e346e271a2d07e4ded2e4e4e1c8b2a80efdbfd0a41d39c615bee75e61c582d9fa5cda514f74fb164a197f136ea7b1bf170b618b2b383d
|
7
|
+
data.tar.gz: e88fe7b9c0c8aef4a03f630315b9813ec1bbe5cda5851cadda400b9ea110903cb62732ccf6b89e3b0d35aebe982280c34d49558259e1b40de2d385d599e0565c
|
data/lib/remap/compiler.rb
CHANGED
@@ -176,12 +176,12 @@ module Remap
|
|
176
176
|
# output.fetch(:value) # => { car: "Volvo" }
|
177
177
|
#
|
178
178
|
# @return [Rule::Embed]
|
179
|
-
def embed(mapper)
|
179
|
+
def embed(mapper, backtrace: caller)
|
180
180
|
if block_given?
|
181
181
|
raise ArgumentError, "#embed does not take a block"
|
182
182
|
end
|
183
183
|
|
184
|
-
embeding = rule.add do |state, &error|
|
184
|
+
embeding = rule(backtrace: backtrace).add do |state, &error|
|
185
185
|
mapper.call!(state.set(mapper: mapper)) do |failure|
|
186
186
|
next error[failure]
|
187
187
|
end.except(:mapper, :scope)
|
@@ -225,12 +225,12 @@ module Remap
|
|
225
225
|
# @raise [ArgumentError]
|
226
226
|
# if no path given
|
227
227
|
# if path is not a Symbol or Array<Symbol>
|
228
|
-
def set(*path, to:)
|
228
|
+
def set(*path, to:, backtrace: caller)
|
229
229
|
if block_given?
|
230
230
|
raise ArgumentError, "#set does not take a block"
|
231
231
|
end
|
232
232
|
|
233
|
-
add rule(to: path).add { to.call(_1) }
|
233
|
+
add rule(to: path, backtrace: backtrace).add { to.call(_1) }
|
234
234
|
end
|
235
235
|
|
236
236
|
# Maps to path from map with block in between
|
@@ -280,8 +280,8 @@ module Remap
|
|
280
280
|
# @see #to
|
281
281
|
#
|
282
282
|
# @return [Rule::Map::Optional]
|
283
|
-
def to?(*path, map: EMPTY_ARRAY, &block)
|
284
|
-
add rule?(*map, to: path, &block)
|
283
|
+
def to?(*path, map: EMPTY_ARRAY, backtrace: caller, &block)
|
284
|
+
add rule?(*map, to: path, backtrace: backtrace, &block)
|
285
285
|
end
|
286
286
|
|
287
287
|
# Iterates over the input value, passes each value
|
@@ -341,12 +341,12 @@ module Remap
|
|
341
341
|
#
|
342
342
|
# @return [Rule::Wrap]
|
343
343
|
# @raise [ArgumentError] if type is not :array
|
344
|
-
def wrap(type, &block)
|
344
|
+
def wrap(type, backtrace: caller, &block)
|
345
345
|
unless block_given?
|
346
346
|
raise ArgumentError, "#wrap requires a block"
|
347
347
|
end
|
348
348
|
|
349
|
-
add rule(&block).then { Array.wrap(_1) }
|
349
|
+
add rule(backtrace: backtrace, &block).then { Array.wrap(_1) }
|
350
350
|
end
|
351
351
|
|
352
352
|
# Selects all elements
|
@@ -394,12 +394,12 @@ module Remap
|
|
394
394
|
# output.fetch(:value) # => { api_key: "<SECRET>" }
|
395
395
|
#
|
396
396
|
# @return [Rule::Static::Fixed]
|
397
|
-
def value(value)
|
397
|
+
def value(value, backtrace: caller)
|
398
398
|
if block_given?
|
399
399
|
raise ArgumentError, "option selector does not take a block"
|
400
400
|
end
|
401
401
|
|
402
|
-
Static::Fixed.new(value: value)
|
402
|
+
Static::Fixed.new(value: value, backtrace: backtrace)
|
403
403
|
end
|
404
404
|
|
405
405
|
# Static option to be selected
|
data/lib/remap/selector/index.rb
CHANGED
data/lib/remap/static/option.rb
CHANGED
@@ -26,11 +26,11 @@ module Remap
|
|
26
26
|
#
|
27
27
|
# @return [State]
|
28
28
|
def call(state)
|
29
|
-
state.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
value = state.options.fetch(name) do
|
30
|
+
raise ArgumentError, "Option [%s] not found" % [name], backtrace
|
31
|
+
end
|
32
|
+
|
33
|
+
state.set(value)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|