To define a constant you could use Module#const_set, and you can avoid reopening the class with Module#instance_exec; maybe this isn”Ēt better, though.

--  
Fuad Saud