lib/the_help/service.rb in the_help-3.4.0 vs lib/the_help/service.rb in the_help-3.5.0

- old
+ new

@@ -104,12 +104,12 @@ end # Convenience method to instantiate the service and immediately call it # # Any arguments are passed to #initialize - def call(*args, &block) - new(*args).call(&block) + def call(*args, **options, &block) + new(*args, **options).call(&block) end # :nodoc: def inherited(other) other.instance_variable_set(:@required_inputs, required_inputs.dup) @@ -339,19 +339,25 @@ def check_result! raise TheHelp::NoResultError if result.pending? end - def run_callback(callback, *args) + def run_callback(callback, *args, **options) continue = false continue = catch(:stop) do - callback.call(*args) + if options.empty? + # Satisfies Ruby 2.4 and friends - where straightforward `, **options` + # still lands as separated `{}` parameter into the lambda.. + callback.call(*args) + else + callback.call(*args, **options) + end true end self.stop_caller ||= !continue end - def delegate_to_service(*args) - call_service(*args) { |result| @result = result } + def delegate_to_service(*args, **options) + call_service(*args, **options) { |result| @result = result } end end end