[Rails-spinoffs] Re: best way to remove item from array

2008-05-06 Thread Justin Perkins
> The "proxy" is being made this way so that you can simply pass it to > most of enumerable methods - i.e. "function iterator(value, index) Yeah I figured it out shortly after I posted that last message, as you might have guessed I've never used a named function for an iterator before, but it s

[Rails-spinoffs] Re: best way to remove item from array

2008-05-06 Thread kangax
The "proxy" is being made this way so that you can simply pass it to most of enumerable methods - i.e. "function iterator(value, index) { return }". You can of course call it on its own. - kangax On May 6, 9:57 am, "Justin Perkins" <[EMAIL PROTECTED]> wrote: > Can you explain this proxy method

[Rails-spinoffs] Re: best way to remove item from array

2008-05-06 Thread Matt Foster
I'm pretty sure Array.splice is a native method, there is documentation on the w3 schools site. http://www.w3schools.com/jsref/jsref_splice.asp -- Matt Foster Ajax Engineer Nth Penguin, LLC http://www.nthpenguin.com On May 5, 11:59 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote: > O

[Rails-spinoffs] Re: best way to remove item from array

2008-05-06 Thread Justin Perkins
Can you explain this proxy method a bit more for me... > Regarding your snippet, what about something like: > > var SomeClass = Class.create({ > initialize: function(index) { > this.index = index; > } > }) > > // it might sense to use iterator-like "proxy" for filtering > SomeClass.c

[Rails-spinoffs] Re: best way to remove item from array

2008-05-05 Thread Justin Perkins
On Mon, May 5, 2008 at 7:04 PM, kangax <[EMAIL PROTECTED]> wrote: > > Justin, > there's no need to "wrap" array with $A. Array.prototype is already Thanks for the tip, I'm paranoid. IE has scarred me. I'll try to remember that. I usually initialize with this.foo = $A(), so that's what I was doi

[Rails-spinoffs] Re: best way to remove item from array

2008-05-05 Thread kangax
Justin, there's no need to "wrap" array with $A. Array.prototype is already extended with Enumerable. I'm not sure why you would want to "compact" a result in first example: [1,2,3,4,5].findAll(function(n) { return n != 4; }); // [1,2,3,5] // or [1,2,3,4,5].reject(function(n) { return n ==