This is a simple one, I hope. How do I check, in the following example, if a constant is already defined?
#this works var = var||1 puts var var = var||2 put
CONST = 2 unless defined? CONST
See here for more about awesome defined? operator.
defined?
P.S. And in the future I guess you'll want var ||= 1 instead of var = var||1.
var ||= 1
var = var||1