From: Josh Cheek Date: 2011-08-10T04:49:13+09:00 Subject: Re: *WHY* does this not work? --0003255758ae43b01a04aa17dbca Content-Type: text/plain; charset=ISO-8859-1 On Tue, Aug 9, 2011 at 2:38 PM, serialhex wrote: > > look at the strip_python_loads method, that is the *best* way i can come up > with at the moment. yes i know there are better ways (to write this and > the > entire program) but what are they? if i wanted to edit the contents of an > array while iterating through it how do it do it besides that? like i > said, > a method such as each! which will allow you to modify the receiver would be > nice... > hex > > It has been pointed out several times that Array#map! does this. In your case, though, it looks like you'd prefer Array#reject! def strip_python_loads @file_lines.reject! { |line| line =~ /\s*from[ A-Za-z0-9\_.]*import\s*\w*/ } end --0003255758ae43b01a04aa17dbca--