Currently, I'm doing this:
(in initialize)
@all = Stuff.all.each.map {|t| t.reference_date }
@uniques = @all.uniq
results = []
@uniques.each do |k|
i = 0
@all.each do |x|
i += 1 if x =~ %r{#{x}}
end
results << [k, i]
end
And that's fine. It's going to work. But I like to avoid regular expressions when I can. I think they are a bit feo. That's spanish for ugly.
EDIT--
actually, that's not working because ruby "puts" the date as a numbered format like 2012-03-31
when the date object is placed inside of a string (as a variable, here), but its really a date object, so this worked:
if x.month == k.month && x.day == k.day
i += 1
end