lib/bolt/transport/base.rb in bolt-0.17.2 vs lib/bolt/transport/base.rb in bolt-0.18.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'logging'
module Bolt
module Transport
# This class provides the default behavior for Transports. A Transport is
@@ -51,18 +53,18 @@
def initialize
@logger = Logging.logger[self]
end
def with_events(target, callback)
- callback.call(type: :node_start, target: target) if callback
+ callback&.call(type: :node_start, target: target)
result = begin
yield
rescue StandardError => ex
Bolt::Result.from_exception(target, ex)
end
- callback.call(type: :node_result, result: result) if callback
+ callback&.call(type: :node_result, result: result)
result
end
def filter_options(target, options)
if target.options['run-as']