u-case 2.6.0 → 3.0.0.rc5
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/.travis.sh +3 -2
- data/Gemfile +11 -2
- data/README.md +472 -441
- data/README.pt-BR.md +1390 -0
- data/lib/micro/case.rb +96 -77
- data/lib/micro/case/config.rb +23 -0
- data/lib/micro/case/error.rb +24 -18
- data/lib/micro/case/result.rb +94 -55
- data/lib/micro/case/safe.rb +8 -4
- data/lib/micro/case/utils.rb +7 -0
- data/lib/micro/case/version.rb +1 -1
- data/lib/micro/case/with_activemodel_validation.rb +4 -2
- data/lib/micro/cases.rb +16 -0
- data/lib/micro/cases/flow.rb +86 -0
- data/lib/micro/cases/safe/flow.rb +18 -0
- data/lib/u-case/with_activemodel_validation.rb +0 -2
- data/u-case.gemspec +3 -3
- metadata +19 -12
- data/lib/micro/case/flow.rb +0 -48
- data/lib/micro/case/flow/reducer.rb +0 -104
- data/lib/micro/case/safe/flow.rb +0 -44
- data/lib/u-case/with_validation.rb +0 -6
data/lib/micro/case/safe/flow.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Micro
|
4
|
-
class Case
|
5
|
-
class Safe
|
6
|
-
module Flow
|
7
|
-
def self.included(base)
|
8
|
-
base.send(:include, ::Micro::Case::Flow)
|
9
|
-
|
10
|
-
def base.flow_reducer; Reducer; end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Reducer < ::Micro::Case::Flow::Reducer
|
14
|
-
alias_method :&, :>>
|
15
|
-
|
16
|
-
def >>(arg)
|
17
|
-
raise NoMethodError, "undefined method `>>' for #{self.inspect}. Please, use the method `&' to avoid this error."
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def next_use_case_result(use_case, result, input)
|
23
|
-
begin
|
24
|
-
instance = use_case.__new__(result, input)
|
25
|
-
instance.call
|
26
|
-
rescue => exception
|
27
|
-
raise exception if Error::ByWrongUsage.check(exception)
|
28
|
-
|
29
|
-
result.__set__(false, exception, :exception, instance)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.Flow(args)
|
36
|
-
Flow::Reducer.build(Array(args))
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.__flow_reducer
|
40
|
-
Flow::Reducer
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|