25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/action_logic/action_core.rb', line 25
def execute!(params, &block)
execution_context = self.new(params)
return execution_context.context if execution_context.break?
execution_context.set_validation_rules
execution_context.validations!(:before)
execution_context.validations!(:around)
begin
block.call(execution_context)
rescue => e
if execution_context.respond_to?(:error)
execution_context.error(e)
else
raise e
end
end
execution_context.validations!(:after)
execution_context.validations!(:around)
execution_context.context
end
|