From: David Douthitt Date: 2000-03-15T16:15:08-06:00 Subject: [ruby-talk:01870] Scanning for comments.... >>> Dave Thomas 03/15/00 03:50PM >>> "David Douthitt" writes: > Why not use this pattern substitution (instead of gsub! and yield) - > > line = s/[ \t]*#.*$//; > next if /^$/; > > Not sure how that translates to Ruby.... The s/// is a sub(/\s*#.*/, ''). The only reason for the separate method is reusability: the next time you need to read an Oracle configuration or whatever you've got the useful configReader method in your toolkit. >>>snip!<<< I wasn't talking about method v. otherwise necessarily - just the guts of it. You could just plop the core into a method, right? I would actually prefer to do this from a code-quality and code-documentation standpoint. After all, what's this do (QUICK!) : line.gsub!(/\s*#.*/, '') next if (line =~ /^$/) Now, what's this do: next if line.comment? See?