metaprogramming
class Foo CONST_1 = 1 CONST_2 = 2 class_eval do constants.each { |c| define_method(c.downcase) { self.class.const_get c } } end end