diff options
author | Nathan Broadbent <nathan.f77@gmail.com> | 2012-01-30 01:27:43 +0800 |
---|---|---|
committer | Nathan Broadbent <nathan.f77@gmail.com> | 2012-01-30 03:15:51 +0800 |
commit | bf928bc7329640969917eb680da4de959b7156b7 (patch) | |
tree | 13d51eda9d6462d73c3f1114621b67961ea41012 /activerecord/Rakefile | |
parent | b31eac56097a0bfc5f5af70de91ad261067a395f (diff) | |
download | rails-bf928bc7329640969917eb680da4de959b7156b7.tar.gz rails-bf928bc7329640969917eb680da4de959b7156b7.tar.bz2 rails-bf928bc7329640969917eb680da4de959b7156b7.zip |
Use block form of 'File.open' so that File object is auto closed at end
Diffstat (limited to 'activerecord/Rakefile')
-rwxr-xr-x | activerecord/Rakefile | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/Rakefile b/activerecord/Rakefile index e7d74b4f3e..98020ad3ab 100755 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -189,13 +189,13 @@ task :lines do FileList["lib/active_record/**/*.rb"].each do |file_name| next if file_name =~ /vendor/ - f = File.open(file_name) - - while line = f.gets - lines += 1 - next if line =~ /^\s*$/ - next if line =~ /^\s*#/ - codelines += 1 + File.open(file_name, 'r') do |f| + while line = f.gets + lines += 1 + next if line =~ /^\s*$/ + next if line =~ /^\s*#/ + codelines += 1 + end end puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}" |