ruby-changes:54523
From: duerst <ko1@a...>
Date: Sun, 6 Jan 2019 20:41:19 +0900 (JST)
Subject: [ruby-changes:54523] duerst:r66738 (trunk): simplify filename-related code
duerst 2019-01-06 20:41:12 +0900 (Sun, 06 Jan 2019) New Revision: 66738 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66738 Log: simplify filename-related code (Thanks to Nobuyoshi Nakada for the hint!) Modified files: trunk/tool/downloader.rb Index: tool/downloader.rb =================================================================== --- tool/downloader.rb (revision 66737) +++ tool/downloader.rb (revision 66738) @@ -84,7 +84,7 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L84 index_file = super(UNICODE_PUBLIC+name_dir_part, "#{name_dir_part}index.html", dir, true, index_options) INDEX[:index] = IO.read index_file end - file_base = name.sub(/^.*\//, '').sub(/\.txt$/, '') + file_base = File.basename(name, '.txt') beta_name = INDEX[:index].match(/#{file_base}(-[0-9.]+d\d+)?\.txt/)[0] # make sure we always check for new versions of files, # because they can easily change in the beta period -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/