I can't really comment on design quality, as 1)mine's never been spifferoonic, and 2)it's hard for me to visualize this in the context of a larger app right now. But here's a coupla ways you might do that.
The most direct port is this:
these_survey_questions.each do |question_type|
clazz = self.class.const_get "SurveyQuestion#{question_type}"
q = clazz.new
q.store_response response_from_this_user
end
Another way would be:
GreatBigFactoryHash = { "MultiChoice" => SurveyQuestionMultiChoice,
"CheckBox" => SurveyQuestionCheckBox, ... }
these_survey_questions.each do |question_type|
clazz = GreatBigFactoryHash[question_type]
q = clazz.new
q.store_response response_from_this_user
end
I'm sure there's a better way, but it's not occurring to me right now.
Devin