remap 2.2.35 → 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 +12 -12
- data/lib/remap/notice/error.rb +6 -1
- data/lib/remap/rule/block.rb +7 -3
- data/lib/remap/selector/index.rb +1 -1
- data/lib/remap/state/extension.rb +1 -1
- data/lib/remap/static/option.rb +5 -5
- metadata +2 -2
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
|
@@ -308,12 +308,12 @@ module Remap
|
|
308
308
|
#
|
309
309
|
# @return [Rule::Each]]
|
310
310
|
# @raise [ArgumentError] if no block given
|
311
|
-
def each(&block)
|
311
|
+
def each(backtrace: caller, &block)
|
312
312
|
unless block_given?
|
313
313
|
raise ArgumentError, "#each requires a block"
|
314
314
|
end
|
315
315
|
|
316
|
-
add rule(all, &block)
|
316
|
+
add rule(all, backtrace: backtrace, &block)
|
317
317
|
end
|
318
318
|
|
319
319
|
# Wraps output in type
|
@@ -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/notice/error.rb
CHANGED
data/lib/remap/rule/block.rb
CHANGED
@@ -23,11 +23,15 @@ module Remap
|
|
23
23
|
return state.except(:value)
|
24
24
|
end
|
25
25
|
|
26
|
-
rules.
|
27
|
-
rule.call(state) do |failure|
|
26
|
+
rules.reduce(state.except(:value)) do |s1, rule|
|
27
|
+
result = rule.call(state) do |failure|
|
28
28
|
return error[failure]
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
|
+
s1.combine(result)
|
32
|
+
rescue Notice::Fatal => e
|
33
|
+
raise e.traced(rule.backtrace)
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linus Oleander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|