I have a hash of dates to money, and I need to put new money deposits inbetween a set of dates.
so, lets say my hash is
{"000000001" => "0.00", "000000002" ="12.34", "000000010" => "5.95"}
and I want to insert 000000008, 54.34
then my resulting hash should be
{"000000001" => "0.00", "000000002" ="66.68", "000000010" => "5.95"}
*(These are example time stamps)
so... I was thinking something like...
my_hash.each_with_index do |key_value, index|
if index == my_hash.length then return my_hash end
if time >= my_hash[dat[0]][0].to_i and time <= my_hash[dat[0]].next[0].to_i
my_hash[index][1] += value
end
end
end
which I know is invalid, but I need help. Thanks!