So I've taken a break from programming for a couple years and trying
to get back into it, feeling quite like trying to ride a bike through
the mud.

What I'm trying to do is use a variable as a hash key, like so:

def time_advance(date,advance_by,unit)
   return date.to_time.advance({ advance_by => unit.to_i})
end

function being called would look something like this - time_advance
("Tue Aug 04 22:41:00 UTC 2009","weeks","3"), so the function being
called would look like this if I hard-wrote it in:

"Tue Aug 04 22:41:00 UTC 2009".to_time.advance({ :weeks => "3".to_i })


How do I do?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to