class Class def kattr_reader(*syms) syms.each do |sym| self.class.send(:define_method, sym) do return nil unless class_variable_defined? "@@#{sym}" return class_variable_get "@@#{sym}" end end end alias_method :cattr_reader, :kattr_reader end