lib/bolt/result.rb in bolt-1.45.0 vs lib/bolt/result.rb in bolt-1.47.0
- old
+ new
@@ -93,11 +93,10 @@
def initialize(target, error: nil, message: nil, value: nil, action: nil, object: nil)
@target = target
@value = value || {}
@action = action
@object = object
- @value_set = !value.nil?
if error && !error.is_a?(Hash)
raise "TODO: how did we get a string error"
end
@value['_error'] = error if error
@value['_output'] = message if message
@@ -105,10 +104,14 @@
def message
@value['_output']
end
+ def message?
+ message && !message.strip.empty?
+ end
+
def status_hash
# DEPRECATION: node in status hashes is deprecated and should be removed in 2.0
base = {
target: @target.name,
action: action,
@@ -119,12 +122,10 @@
$future ? base.merge(value: @value) : base.merge(result: @value, node: @target.name)
# rubocop:enable Style/GlobalVars
end
def generic_value
- if @value_set
- value.reject { |k, _| %w[_error _output].include? k }
- end
+ value.reject { |k, _| %w[_error _output].include? k }
end
def eql?(other)
self.class == other.class &&
target == other.target &&