lib/the_help/service.rb in the_help-1.2.0 vs lib/the_help/service.rb in the_help-1.2.1
- old
+ new
@@ -124,11 +124,11 @@
#
# Any arguments are passed to #initialize
#
# @return [Class] Returns the receiver
def call(*args, &block)
- new(*args, &block).call
+ new(*args).call(&block)
self
end
# :nodoc:
def inherited(other)
@@ -188,25 +188,18 @@
not_authorized: CB_NOT_AUTHORIZED, **inputs)
self.context = context
self.logger = logger
self.not_authorized = not_authorized
self.inputs = inputs
- if block_given?
- self.result_handler = ->(result) {
- yield result
- }
- end
end
def call
validate_service_definition
catch(:stop) do
authorize
log_service_call
main
- unless result_handler.nil?
- result_handler.call(result)
- end
+ yield result if block_given?
end
self
end
private