Merge pull request #747 from chef/ap/nil-include

Prevent nil.include?
This commit is contained in:
Dominik Richter 2016-05-13 20:28:04 +02:00
commit 8a9cd539fc

View file

@ -48,11 +48,13 @@ module Inspec
if @qualifier.length > 1
last = @qualifier[-1]
# preventing its('to_i') as the value returned is always 0
if last.length == 1 && last[0] !~ /^to_.$/ && !last[0].include?('[')
xres = last[0]
else
res += '.' + ruby_qualifier(last)
unless last.is_a?(Array) && last[0].to_s.empty?
if last.length == 1 && last[0] !~ /^to_.$/ && !last[0].include?('[')
# this will go in its()
xres = last[0]
else
res += '.' + ruby_qualifier(last)
end
end
end