A question on SO was recently closed by 5 members of the community as "not a real question". If you look strictly at the body of the question, that's true, but if you consider the question's title, it was a straightforward question, albeit a rather simple one.
I'm wondering if the title is largely ignored for question-adequacy evaluation purposes or whether there is something else at work here.
Update: For easy reference, the title of the question was
How do I dry up this Ruby array of hashes?
and the code was:
def get_parts(row) [
@@line_parts[row][@time[0]].values[0],
@@line_parts[row][@time[1]].values[0],
@@line_parts[row][@time[2]].values[0],
@@line_parts[row][@time[3]].values[0] ]
end
Update: Since the question has been deleted, I figured I'd document the single, upvoted (8) answer, which was (I believe):
def get_parts(row)
(0..3).collect {|i| @@line_parts[row][@time[i]].values[0]}
end
which I thought did a nice job of demonstrating the power/elegance of Ruby's range, map and lambda features for someone who might only be familiar with more primitive languages.