Martin DeMello
3/13/2007 7:47:00 PM
On 3/14/07, Chad Perrin <perrin@apotheon.com> wrote:
> On Tue, Mar 13, 2007 at 05:36:20PM +0900, Martin DeMello wrote:
> >
> > or for efficiency
> >
> > File.open("/etc/passwd", "r") {|f| id =
> > f.grep(/#{usr}/).first.split(/:/).at(2).to_i}
>
> . . . or for more readability:
>
> File.open("/etc/passwd", "r") do |f|
> id = f.grep(/#{usr}).first.split(/:/).at(2).to_i
> end
>
> I'm sure greater readability can be had by rewriting that entirely, but
> I found the multiline braces approach suboptimal, personally. YMMV.
And the fact that my paste put a line break where it did didn't help
:) that was supposed to be on one line - didn't realise how long it
had gotten.
m.