clean-architecture 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e9b17c830a7278ecdabf96ed831ec41e730bbdd
|
4
|
+
data.tar.gz: 1d4f68de0700753e6163d560a7f6c0d80380b5f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7b8bf9a4f6297c0da3843c068b0741c9e33fbd214c7a64d1084df576e5238c2934064c725527fe55f3287cb5fcada3ee75b5e31ef996117915078638d557af1
|
7
|
+
data.tar.gz: 433a2e52b95353e0b1f00f1f3c6ea1fbbfaddb1fd3bf21239277bdf92b8c63f422f1432012b3c044587325afacf5dc5d572c7d8db4c1eda08dc333f5a9e9af8b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clean-architecture (1.
|
4
|
+
clean-architecture (1.2.0)
|
5
5
|
dry-matcher (~> 0.0)
|
6
6
|
dry-monads (~> 1.0)
|
7
7
|
dry-struct (~> 0.0)
|
@@ -45,7 +45,7 @@ GEM
|
|
45
45
|
concurrent-ruby (~> 1.0)
|
46
46
|
dry-core (~> 0.4, >= 0.4.4)
|
47
47
|
dry-equalizer
|
48
|
-
dry-struct (0.
|
48
|
+
dry-struct (0.6.0)
|
49
49
|
dry-core (~> 0.4, >= 0.4.3)
|
50
50
|
dry-equalizer (~> 0.2)
|
51
51
|
dry-types (~> 0.13)
|
@@ -16,6 +16,14 @@ module CleanArchitecture
|
|
16
16
|
attribute :type, FailureTypes
|
17
17
|
attribute :message, Types::Strict::String
|
18
18
|
attribute :other_properties, Types::Strict::Hash.default({})
|
19
|
+
|
20
|
+
def self.from_array(array)
|
21
|
+
new(message: array.map(&:to_s).join(', '), other_properties: {}, type: 'error')
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.from_string(string)
|
25
|
+
new(message: string, other_properties: {}, type: 'error')
|
26
|
+
end
|
19
27
|
end
|
20
28
|
end
|
21
29
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'clean_architecture/entities/failure_details'
|
3
4
|
require 'dry-matcher'
|
5
|
+
require 'dry/monads/all'
|
4
6
|
|
5
7
|
module CleanArchitecture
|
6
8
|
module Matchers
|
@@ -32,12 +34,15 @@ module CleanArchitecture
|
|
32
34
|
def resolve_failure_value(value)
|
33
35
|
failure = value.failure
|
34
36
|
case failure
|
37
|
+
when Array
|
38
|
+
Entities::FailureDetails.from_array(failure)
|
35
39
|
when String
|
36
|
-
Entities::FailureDetails.
|
40
|
+
Entities::FailureDetails.from_string(failure)
|
37
41
|
when Entities::FailureDetails
|
38
42
|
failure
|
39
43
|
else
|
40
|
-
|
44
|
+
type_list = [Array, String, Entities::FailureDetails].map(&:to_s).join(' or ')
|
45
|
+
raise ArgumentError, "Unexpected failure value - must be #{type_list}"
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clean-architecture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bellroy Tech Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-matcher
|