On Monday, February 11, 2013 3:46:46 PM UTC+1, Jordon Bedwell wrote:
>
> On Mon, Feb 11, 2013 at 8:33 AM, Javix <[email protected] <javascript:>> 
> wrote: 
> > I wonder why ruby core method 'take_while' does not work as expected in 
> the 
> > below Rails console example: 
> > 
> > irb(main):003:0> arr = [] 
> > => [] 
>
> Yep, exact, 'select' works as needed. By the way, is there a way (I find 
no method neither in Rails API for Array nor in Ruby core library, to split 
an array in sub-arrays by month ?
 Thanks

> Enumerable#take_while short-circuits on nil or false, hence the while 
> in it's name.  Use Enumerable#select 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/fma6xIvJjUAJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to