Q:

if statement: check which condition qualifies

If I have an if statement
x = 2
y = 1
if x == nil || y == nil || z == nil
  raise "RuntimeError: Argument is nil"
end

would it be possible to do something like 
raise "RuntimeError: ${Argument} is nil"

where the argument is the variable that is nil? Or, do I have to separate the conditions for that to work?
if x == nil 
  raise "RuntimeError: x is nil"
end

if y == nil 
  raise "RuntimeError: y is nil"
end

if z == nil 
  raise "RuntimeError: z is nil"
end

Is it possible to find which condition for an if statement passes so that the code inside that block is executed? In this case, it would be z == nil.

A:

While something like this "works":
%w(x y z).each { |var| raise "#{var} is nil" if eval(var).nil? }

I'd write one-liners:
raise "x is nil" if x.nil?
raise "y is nil" if y.nil?
raise "z is nil" if z.nil?

It's much easier to understand.

