From: Joao Silva Date: 2009-12-11T03:12:30+09:00 Subject: Re: Fill gaps in Array of Hashes Aldric Giacomoni wrote: > Joao Silva wrote: >> I have the following object as a result from MySQL: >> >> [{:positive=>"0", :neutral=>"2", :total=>"5", :date=>"2009-12-01", >> :negative=>"3"}, {:positive=>"3", :neutral=>"3", :total=>"7", >> :date=>"2009-12-08", :negative=>"1"}, {:positive=>"1", :neutral=>"1", >> :total=>"3", :date=>"2009-12-09", :negative=>"1"}] >> >> I want to fill gaps (for example from 2009-11-19 till 2010-10-01) with >> {:positive=>"0", :neutral=>"0", :total=>"0", :date=>"HEREDATE", >> :negative=>"1" - how i can do this in ruby? In MySQL it's impossible to >> do :-(. > > Alright... Now that I've helped you do what you asked for, please tell > us what you actually want to do, because actually filling up a hash with > default data is really not optimal. I don't have choice: I need data formed like this to generate report (chart) data. And i need for each day approporiate values. -- Posted via http://www.ruby-forum.com/.