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.
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Micro
4
4
  class Case
5
- VERSION = '5.6.0'.freeze
5
+ VERSION = '5.7.1'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u-case
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.0
4
+ version: 5.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Serradura