vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb in bolt-0.21.7 vs vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb in bolt-0.21.8
- old
+ new
@@ -402,11 +402,11 @@
unless ARITHMETIC_OPERATORS.include?(operator)
fail(Issues::UNSUPPORTED_OPERATOR, bin_expr, {:operator => operator})
end
left_o = bin_expr.left_expr
- if left.is_a?(URI) && operator == '+'
+ if (left.is_a?(URI) || left.is_a?(Types::PBinaryType::Binary)) && operator == '+'
concatenate(left, right)
elsif (left.is_a?(Array) || left.is_a?(Hash)) && COLLECTION_OPERATORS.include?(operator)
# Handle operation on collections
case operator
when '+'
@@ -1219,9 +1219,12 @@
end
x.merge y # new hash with overwrite
when URI
raise ArgumentError.new(_('An URI can only be merged with an URI or String')) unless y.is_a?(String) || y.is_a?(URI)
x + y
+ when Types::PBinaryType::Binary
+ raise ArgumentError.new(_('Can only append Binary to a Binary')) unless y.is_a?(Types::PBinaryType::Binary)
+ Types::PBinaryType::Binary.from_binary_string(x.binary_buffer + y.binary_buffer)
else
concatenate([x], y)
end
end