u-case 5.6.0 → 5.7.1
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/CHANGELOG.md +16 -0
- data/README.md +1016 -1464
- data/README.pt-BR.md +1008 -1490
- data/lib/micro/case/result.rb +26 -0
- data/lib/micro/case/version.rb +1 -1
- metadata +1 -1
data/lib/micro/case/result.rb
CHANGED
|
@@ -50,6 +50,32 @@ module Micro
|
|
|
50
50
|
@__success ? :success : :failure
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
def deconstruct
|
|
54
|
+
[@__success ? :success : :failure, type, data]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def deconstruct_keys(keys)
|
|
58
|
+
if keys.nil?
|
|
59
|
+
hash = { type: type, data: data, result: data, use_case: use_case, transitions: transitions }
|
|
60
|
+
hash[@__success ? :success : :failure] = type
|
|
61
|
+
return hash
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
hash = {}
|
|
65
|
+
keys.each do |key|
|
|
66
|
+
case key
|
|
67
|
+
when :type then hash[:type] = type
|
|
68
|
+
when :data then hash[:data] = data
|
|
69
|
+
when :result then hash[:result] = data
|
|
70
|
+
when :use_case then hash[:use_case] = use_case
|
|
71
|
+
when :transitions then hash[:transitions] = transitions
|
|
72
|
+
when :success then hash[:success] = type if @__success
|
|
73
|
+
when :failure then hash[:failure] = type if !@__success
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
hash
|
|
77
|
+
end
|
|
78
|
+
|
|
53
79
|
def [](key)
|
|
54
80
|
data[key]
|
|
55
81
|
end
|
data/lib/micro/case/version.rb
CHANGED