remap 2.2.42 → 2.2.43
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/base.rb +20 -2
- data/lib/remap/config.rb +9 -0
- data/lib/remap/mapper/and.rb +6 -0
- data/lib/remap/mapper/binary.rb +5 -0
- data/lib/remap/mapper/or.rb +6 -0
- data/lib/remap/mapper/support/api.rb +16 -0
- data/lib/remap/mapper/xor.rb +6 -0
- data/lib/remap/state/extension.rb +7 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88fc0978315944ad791a089536840916db814b0fc7dad18cda8c19d1c9901d9c
|
4
|
+
data.tar.gz: 2b59e22a02ac486b04758c772082731b2e91cb0ba698e40e3502794236515ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41a5d60aa1fa66fb254162d1313611e441e239de54e59c4d7ebaa8a5334a6930317cb32703bd837e85212826b23286afa57e9d8662d8e9c78ab4fc3d569bcddd
|
7
|
+
data.tar.gz: 3c8b89c3a3cb5a4fae156a0757b2130afc95ced6911b2707e239e7a3dd791ed5036b46711fb4262b94006b027bc0e98f0882e5a2e4131a12c7730542699e7068
|
data/lib/remap/base.rb
CHANGED
@@ -107,13 +107,12 @@ module Remap
|
|
107
107
|
include ActiveSupport::Configurable
|
108
108
|
include Dry::Core::Constants
|
109
109
|
include Catchable
|
110
|
-
|
111
110
|
extend Mapper::API
|
112
|
-
|
113
111
|
using State::Extension
|
114
112
|
|
115
113
|
with_options instance_accessor: true do |scope|
|
116
114
|
scope.config_accessor(:contract) { Dry::Schema.define {} }
|
115
|
+
scope.config_accessor(:config_options) { Config.new }
|
117
116
|
scope.config_accessor(:constructor) { IDENTITY }
|
118
117
|
scope.config_accessor(:options) { EMPTY_ARRAY }
|
119
118
|
scope.config_accessor(:option) { EMPTY_HASH }
|
@@ -265,6 +264,25 @@ module Remap
|
|
265
264
|
new(state.options).call(state, &error)
|
266
265
|
end
|
267
266
|
|
267
|
+
# Configuration options for the mapper
|
268
|
+
#
|
269
|
+
# @yield [Config]
|
270
|
+
# @yieldreturn [void]
|
271
|
+
#
|
272
|
+
# @return [void]
|
273
|
+
def self.configuration(&block)
|
274
|
+
config = Config.new
|
275
|
+
block[config]
|
276
|
+
self.config_options = config
|
277
|
+
end
|
278
|
+
|
279
|
+
# @see Mapper::API
|
280
|
+
#
|
281
|
+
# @private
|
282
|
+
def self.validate?
|
283
|
+
config_options.validation
|
284
|
+
end
|
285
|
+
|
268
286
|
# Mappers state according to the mapper rules
|
269
287
|
#
|
270
288
|
# @param state [State]
|
data/lib/remap/config.rb
ADDED
data/lib/remap/mapper/and.rb
CHANGED
data/lib/remap/mapper/binary.rb
CHANGED
data/lib/remap/mapper/or.rb
CHANGED
@@ -5,6 +5,22 @@ module Remap
|
|
5
5
|
using State::Extension
|
6
6
|
|
7
7
|
module API
|
8
|
+
# @return [Boolean]
|
9
|
+
#
|
10
|
+
# @abstract
|
11
|
+
# @private
|
12
|
+
def validate?
|
13
|
+
raise NotImplementedError, "`validate?` is not implemented for #{self}"
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param input [Any]
|
17
|
+
# @param backtrace [Array<String>]
|
18
|
+
# @param options [Hash]
|
19
|
+
#
|
20
|
+
# @yieldparam [Failure]
|
21
|
+
# @yieldreturn [T]
|
22
|
+
#
|
23
|
+
# @return [Any, T]
|
8
24
|
def call(input, backtrace: caller, **options, &error)
|
9
25
|
unless block_given?
|
10
26
|
return call(input, **options) do |failure|
|
data/lib/remap/mapper/xor.rb
CHANGED
@@ -92,6 +92,8 @@ module Remap
|
|
92
92
|
#
|
93
93
|
# @return [self]
|
94
94
|
def _(&block)
|
95
|
+
return self unless mapper.validate?
|
96
|
+
|
95
97
|
unless block
|
96
98
|
return _ do |reason|
|
97
99
|
raise ArgumentError, "[BUG] State: #{formatted} reason: #{reason.formatted}"
|
@@ -320,6 +322,11 @@ module Remap
|
|
320
322
|
fetch(:id)
|
321
323
|
end
|
322
324
|
|
325
|
+
# @return [Mapper::API]
|
326
|
+
def mapper
|
327
|
+
fetch(:mapper)
|
328
|
+
end
|
329
|
+
|
323
330
|
# @return [Array<Symbol>]
|
324
331
|
def ids
|
325
332
|
fetch(:ids)
|
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.43
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -251,6 +251,7 @@ files:
|
|
251
251
|
- lib/remap/catchable.rb
|
252
252
|
- lib/remap/class_interface.rb
|
253
253
|
- lib/remap/compiler.rb
|
254
|
+
- lib/remap/config.rb
|
254
255
|
- lib/remap/constructor.rb
|
255
256
|
- lib/remap/constructor/argument.rb
|
256
257
|
- lib/remap/constructor/keyword.rb
|