Whats the best way in Ruby to do something like my_array.select(n){ |elem| ... }, where the n means “I only want n elements returned, and stop evaluating after that number is reached”?
Whats the best way in Ruby to do something like my_array.select(n){ |elem| … }
Share
Looks like there’s no avoiding a traditional loop if you’re using stock 1.8.7 or 1.9.2…