Sha256: 4ec73bf7e96641746533355ff9d98bd833ceab47f9b16c3281ce9a0fcfcc73b1
Contents?: true
Size: 1.17 KB
Versions: 5
Compression:
Stored size: 1.17 KB
Contents
# Magic! module BusinessFlow # More magic! # call! to raise errors # Hooks for cross cutting concerns # Figure out how much we can freeze # :reek:ModuleInitialize module Base def self.included(klass) klass.include(DSL) klass.prepend(InstanceMethods) end # "Helper" methods which we put on an object to provide some default # behavior. module InstanceMethods attr_reader :parameter_object private :parameter_object # Initialize is here so that we can set the parameter object, and then # allow our "parent" class to handle any additional initialization that # it needs to do. def initialize(parameter_object) @parameter_object = parameter_object catch(:halt_step) do super() end end def call # If our initialization process set any errors, return return if errors.any? || invalid? if defined?(super) catch(:halt_step) do super end else ::BusinessFlow::DefaultStepExecutor.new(self.class.step_queue, self) .call end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems