lib/micro/case/flow.rb in u-case-1.1.0 vs lib/micro/case/flow.rb in u-case-2.0.0.pre
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
module Micro
- module Case
+ class Case
module Flow
module ClassMethods
def __flow__
@__flow
end
@@ -18,39 +18,32 @@
end
CONSTRUCTOR = <<-RUBY
def initialize(options)
@options = options
+
flow = self.class.__flow__
+
raise Error::UndefinedFlow unless flow
end
RUBY
private_constant :ClassMethods, :CONSTRUCTOR
def self.included(base)
def base.flow_reducer; Reducer; end
+
base.extend(ClassMethods)
+
base.class_eval(CONSTRUCTOR)
end
def self.[](*args)
Reducer.build(args)
end
def call
self.class.__flow__.call(@options)
- end
-
- module Safe
- def self.included(base)
- base.send(:include, Micro::Case::Flow)
- def base.flow_reducer; SafeReducer; end
- end
-
- def self.[](*args)
- SafeReducer.build(args)
- end
end
end
end
end