lib/ufo/utils/squeezer.rb in ufo-6.1.1 vs lib/ufo/utils/squeezer.rb in ufo-6.1.2
- old
+ new
@@ -7,10 +7,12 @@
def squeeze(new_data=nil)
data = new_data.nil? ? @data : new_data
case data
when Array
- data.map! { |v| squeeze(v) }
+ # .compact prevents infinite loop when data = [nil] on accident
+ # IE: config.elb.ssl.certificates = acm_cert("domain.not.found")
+ data.compact.map! { |v| squeeze(v) }
when Hash
data.each_with_object({}) do |(k,v), squeezed|
# only remove nil and empty Array values within Hash structures
squeezed[k] = squeeze(v) unless v.nil? # || v.is_a?(Array) && v.empty?
squeezed