dry-mutations 0.10.1 → 0.10.2
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/dry/mutations.rb +1 -0
- data/lib/dry/mutations/patches.rb +7 -0
- data/lib/dry/mutations/utils/dry-mutations.rb +17 -6
- data/lib/dry/mutations/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f80c93415873bc8756754a386cc570e876ce5bf
|
4
|
+
data.tar.gz: 7a9e9eb7334916480d10898b003fe81e06917d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce605855827a02da898e788fa79ba1d54fafbc29b5cb60d61d5062bf0740cb223d57279b08ec2a96c6fdc4e349af6c2fca4f38783b7d5d2269ef21e9656af64f
|
7
|
+
data.tar.gz: c8bd9287b5f3c8896f32009d5cba45a8c1b162df180490ae83aa9f57cedc4684af5f72980b1c4df0b7776d88344c3a4ea79c956305993a1a62950d9f3296a8de
|
data/lib/dry/mutations.rb
CHANGED
@@ -56,12 +56,23 @@ module Dry
|
|
56
56
|
::Dry::Types['strict.date'], fn: ->(v) { v.is_a?(Date) ? v : (Date.parse(v.to_s) rescue v) }
|
57
57
|
)
|
58
58
|
when 'integer'
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
::Dry::Types::Constructor.new(
|
60
|
+
::Dry::Types['strict.int'], fn: ->(v) { v.is_a?(Integer) ? v : (v.to_i rescue v) }
|
61
|
+
)
|
62
|
+
when 'boolean'
|
63
|
+
::Dry::Types::Constructor.new(
|
64
|
+
::Dry::Types['strict.bool'], fn: ->(v) do
|
65
|
+
case v
|
66
|
+
when TrueClass, FalseClass then v
|
67
|
+
when NilClass then false
|
68
|
+
when String
|
69
|
+
case
|
70
|
+
when Falsey?(v) then false
|
71
|
+
when Truthy?(v) then true
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
)
|
65
76
|
else :"#{type}?"
|
66
77
|
end
|
67
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-mutations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksei Matiushkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -353,6 +353,7 @@ files:
|
|
353
353
|
- lib/dry/mutations/extensions/outcome.rb
|
354
354
|
- lib/dry/mutations/globals.rb
|
355
355
|
- lib/dry/mutations/monkeypatches.rb
|
356
|
+
- lib/dry/mutations/patches.rb
|
356
357
|
- lib/dry/mutations/predicates.rb
|
357
358
|
- lib/dry/mutations/schema.rb
|
358
359
|
- lib/dry/mutations/transactions.rb
|