remap 2.1.12 → 2.1.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a7b64e11ae09304377105e5dcfbd8414a26cf8b321ff5c49dad106151fd5cd4
4
- data.tar.gz: 47112866b73268437edd2b5e6039394f05c251a666861c05bc48779f88f8c3a8
3
+ metadata.gz: 526ddded05ad56900a9f6d1276069c48297adc6f5cb32ef08b955949bf9ee426
4
+ data.tar.gz: 239295549c9f0365453d19254fe21ff046755b6066f86a81596abaf102a98bbb
5
5
  SHA512:
6
- metadata.gz: a08f53a8d37c1edae16df7490e31a8318021e8cb29320ba34b538587c9d9bc9caa62ac075e9d5e34846d130f31cfacfd5322c6b432c3f85d0f0719d3371d3607
7
- data.tar.gz: 17f6c2ed9e9f5782ac7b0b9cd802da2798b12ba0bd78e48945d952d06ee1da335b745bcf1fb78ca9635b13d39b4df1e2c4c8a0824acd0b5a0343f2c185d6e6c6
6
+ metadata.gz: 1c8d02457838ffe470359e5b9ff97cd2a31288928d238362eb38d85c190160b430242d2cfb401e9f7dbb418be4838dd6cbb1c282b68a7eababf5ad2d48030440
7
+ data.tar.gz: 191f1570f40e582c31e724e788882b54f83ff82e6d37931519451975355ceab5fb708260352523ddc10c849daa86d31c915221e9d539f2c069288462ca5dc45b
@@ -9,6 +9,24 @@ module Remap
9
9
  # Represents an optional mapping rule
10
10
  # When the mapping fails, the value is ignored
11
11
  #
12
+ # @example Map [:name] to [:nickname]
13
+ # map = Map::Optional.call({
14
+ # path: {
15
+ # input: [:name],
16
+ # output: [:nickname]
17
+ # }
18
+ # })
19
+ #
20
+ # state = Remap::State.call({
21
+ # name: "John"
22
+ # })
23
+ #
24
+ # output = map.call(state) do |failure|
25
+ # raise failure.exeception
26
+ # end
27
+ #
28
+ # output.fetch(:value) # => { nickname: "John" }
29
+ #
12
30
  # @param state [State]
13
31
  #
14
32
  # @return [State]
@@ -11,6 +11,25 @@ module Remap
11
11
  # Represents a required mapping rule
12
12
  # When it fails, the entire mapping is marked as failed
13
13
  #
14
+ # @example Map [:name] to [:nickname]
15
+ # map = Map::Required.call({
16
+ # backtrace: caller,
17
+ # path: {
18
+ # input: [:name],
19
+ # output: [:nickname]
20
+ # }
21
+ # })
22
+ #
23
+ # state = Remap::State.call({
24
+ # name: "John"
25
+ # })
26
+ #
27
+ # output = map.call(state) do |failure|
28
+ # raise failure.exeception
29
+ # end
30
+ #
31
+ # output.fetch(:value) # => { nickname: "John" }
32
+ #
14
33
  # @param state [State]
15
34
  #
16
35
  # @return [State]
@@ -28,7 +28,7 @@ module Remap
28
28
  attribute? :path, Path.default { Path.call(EMPTY_HASH) }
29
29
 
30
30
  # @return [Rule]
31
- attribute :rule, Rule.default { Void.call(EMPTY_HASH) }
31
+ attribute? :rule, Rule.default { Void.call(EMPTY_HASH) }
32
32
 
33
33
  # @return [Array<String>]
34
34
  attribute? :backtrace, Types::Backtrace, default: EMPTY_ARRAY
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.12
4
+ version: 2.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linus Oleander