Well, I tried google and it was proving to be difficult cos all I turned up was articles on passing arrays to functions.. and I was pretty sure it was done in prototype so I figured it was a good place to ask.
I like that term, help vampire :) I was trying to apply on the Date constructor though, and the parser didnt seem to like me (the script just stopped executing on that line), so I will play around a bit more and see if I did something dumb or if I need to add an extra set of brackets or something.. It's quite good to have a mailing list such as this which the occasional idea can be bounced off other members... I know it's mostly prototype related but I have noticed an upturn in overall questions recently.. Google is usually my first port of call anyway, followed by asking people :) Gareth On 11/29/07, Thomas Fuchs <[EMAIL PROTECTED]> wrote: > > Slacker! I guess others will profit as well from this info. But don't > you become a Help Vampire[1]. ;) > > - Thomas > [1] http://www.slash7.com/articles/2006/12/22/vampires > > Am 29.11.2007 um 09:22 schrieb Gareth Evans: > > > Thanks Thomas, I thought it was used in prototype but a lot of the > > argument stuff I don't follow. It was quicker to ask :) > > > > Gareth > > > > On Nov 29, 2007 9:21 PM, Thomas Fuchs < [EMAIL PROTECTED]> wrote: > > > > You want Function#apply. > > > > see > http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Function:apply > > > > Best, > > Thomas > > > > Am 29.11.2007 um 07:39 schrieb Gareth Evans: > > > > > Hey Guys > > > > > > Does anyone know if I have an array if I can pass that array to a > > > function, *as* the parameters.. not pass it as a parameter, but > > > effectively have my scoped array become function.arguments . > > > I have a regular expression that splits an ISO date string that's > > > given me a match array, which I then split to drop the first match > > > (the whole string) leaving me with year,month,day,hour,min,sec and I > > > want to pass that to new Date() > > > I could go var d = new Date(ma[0],ma[1],ma[2]... but I figure if I > > > can do the arguments thing then its a technique i could adopt > > > elsewhere. > > > I control both sides of the interface, the source as well as the > > > processing so I know the format will always be the same. > > > (incidentally, the date comes from a .net date originally, and I use > > > a .tostring("s") to get the iso format, which is passed to json as a > > > string - there may be a better way for that) > > > > > > Hope this makes sense, > > > > > > Gareth > > > > > > > > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" 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-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
