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.

One could also split up that string of methods into more than one line
via assignment to variables, but I'm lazy enough to prefer to spend
twice as much effort talking about why I didn't.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Leon Festinger: "A man with a conviction is a hard man to change. Tell
him you disagree and he turns away. Show him facts and figures and he
questions your sources. Appeal to logic and he fails to see your point."