lib/simple_service/organizer.rb in simple_service-1.2.6 vs lib/simple_service/organizer.rb in simple_service-1.3.0

- old
+ new

@@ -4,11 +4,11 @@ include ServiceBase::InstanceMethods extend ServiceBase::ClassMethods attr_accessor :context - def initialize(context={}) + def initialize(context = {}) @context = context symbolize_context_keys setup_call_chain define_getters_and_setters @@ -23,17 +23,19 @@ end def call with_validation do |_commands| _commands.each do |command| - @context.merge!(command.new(context).call) + break if context[:success] == false + new_context = command.new(context).call + @context.merge!(new_context) end end end # allow execution of the service from the class level for those # that prefer that style - def self.call(context) + def self.call(context = {}) self.new(context).call end private