[""]is an array with one element containing an empty String object. [].empty?will return true. @a.nil?returns falsebecause it @ais an Array object, not nil.
Examples:
"".nil?
[].nil?
[""].empty?
[].empty?
[""].all? {|x| x.nil?}
[].all? {|x| x.nil?}
[].all? {|x| x.is_a? Float}
[].all? &:nil?
This last line shows that [].all?it will always return true, because if Array is empty, then by definition all its elements (without elements) fulfill each condition.
source
share