lib/micro/case/safe/flow.rb in u-case-2.0.0.pre.3 vs lib/micro/case/safe/flow.rb in u-case-2.0.0.pre.4
- old
+ new
@@ -9,28 +9,20 @@
def base.flow_reducer; Reducer; end
end
class Reducer < ::Micro::Case::Flow::Reducer
- def call(arg = {})
- @use_cases.reduce(initial_result(arg)) do |result, use_case|
- break result if result.failure?
-
- use_case_result(use_case, result)
- end
- end
-
alias_method :&, :>>
def >>(arg)
raise NoMethodError, "undefined method `>>' for #{self.inspect}. Please, use the method `&' to avoid this error."
end
private
- def use_case_result(use_case, result)
+ def use_case_result(use_case, result, input)
begin
- instance = use_case.__new__(result, result.value)
+ instance = use_case.__new__(result, input)
instance.call
rescue => exception
raise exception if Error::ByWrongUsage.check(exception)
result.__set__(false, exception, :exception, instance)