can-t go in else when nil either

This commit is contained in:
Alex Pop 2016-05-13 19:22:09 +01:00
parent 6a9f015527
commit 4241cbf7ce

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].nil? && !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