ruby-changes:28401
From: nobu <ko1@a...>
Date: Thu, 25 Apr 2013 01:22:54 +0900 (JST)
Subject: [ruby-changes:28401] nobu:r40453 (trunk): tracer.rb: File.readlines
nobu 2013-04-25 01:22:44 +0900 (Thu, 25 Apr 2013) New Revision: 40453 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40453 Log: tracer.rb: File.readlines * lib/tracer.rb (get_line): simply read by File.readlines. Modified files: trunk/ChangeLog trunk/lib/tracer.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 40452) +++ ChangeLog (revision 40453) @@ -1,4 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Thu Apr 25 01:21:51 2013 Nobuyoshi Nakada <nobu@r...> +Thu Apr 25 01:22:41 2013 Nobuyoshi Nakada <nobu@r...> + + * lib/tracer.rb (get_line): simply read by File.readlines. * lib/debug.rb (script_lines): get source lines from SCRIPT_LINES__ or read from the file. Index: lib/tracer.rb =================================================================== --- lib/tracer.rb (revision 40452) +++ lib/tracer.rb (revision 40453) @@ -155,16 +155,8 @@ class Tracer https://github.com/ruby/ruby/blob/trunk/lib/tracer.rb#L155 end unless list = SCRIPT_LINES__[file] - begin - f = File::open(file) - begin - SCRIPT_LINES__[file] = list = f.readlines - ensure - f.close - end - rescue - SCRIPT_LINES__[file] = list = [] - end + list = File.readlines(file) rescue [] + SCRIPT_LINES__[file] = list end if l = list[line - 1] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/