lib/the_help/service.rb in the_help-3.3.1 vs lib/the_help/service.rb in the_help-3.3.2
- old
+ new
@@ -323,17 +323,17 @@
result.error run_callback(not_authorized, service: self.class, context: context)
stop!
end
def stop!(type: :error, **opts)
- if opts.has_key?(:value)
- if type == :success
- result.success value
- else
- result.error value
- end
- else
+ value = opts.fetch(:value) { |key|
check_result!
+ throw :stop
+ }
+ if type == :success
+ result.success value
+ else
+ result.error value
end
throw :stop
end
def check_result!