summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-02-27 16:38:32 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-02-27 18:49:18 +0900
commitdb0a4c8923e0e084c7d757d132a83fc9c8431633 (patch)
tree1ea1f2e494962c6e8c024bd1a60719f305a40341 /tool
parentd063ed12afcb56d919863d6efb4bfa92741c1555 (diff)
downloadruby-db0a4c8923e0e084c7d757d132a83fc9c8431633.tar.gz
Prefer to use File.foreach instead of IO.foreach
Diffstat (limited to 'tool')
-rwxr-xr-xtool/enc-case-folding.rb6
-rwxr-xr-xtool/enc-unicode.rb2
-rwxr-xr-xtool/extlibs.rb2
-rw-r--r--tool/lib/memory_status.rb2
-rwxr-xr-xtool/mkconfig.rb4
5 files changed, 8 insertions, 8 deletions
diff --git a/tool/enc-case-folding.rb b/tool/enc-case-folding.rb
index 76c6b5c48b..82fec7b625 100755
--- a/tool/enc-case-folding.rb
+++ b/tool/enc-case-folding.rb
@@ -61,7 +61,7 @@ class CaseFolding
@version = nil
turkic = []
- IO.foreach(filename, mode: "rb") do |line|
+ File.foreach(filename, mode: "rb") do |line|
@version ||= line[/-([0-9.]+).txt/, 1]
next unless res = pattern.match(line)
ch_from = res[1].to_i(16)
@@ -230,7 +230,7 @@ class CaseMapping
@specials = []
@specials_length = 0
@version = nil
- IO.foreach(File.join(mapping_directory, 'UnicodeData.txt'), mode: "rb") do |line|
+ File.foreach(File.join(mapping_directory, 'UnicodeData.txt'), mode: "rb") do |line|
next if line =~ /^</
code, _, _, _, _, _, _, _, _, _, _, _, upper, lower, title = line.chomp.split ';'
unless upper and lower and title and (upper+lower+title)==''
@@ -239,7 +239,7 @@ class CaseMapping
end
@filename = File.join(mapping_directory, 'SpecialCasing.txt')
- IO.foreach(@filename, mode: "rb") do |line|
+ File.foreach(@filename, mode: "rb") do |line|
@version ||= line[/-([0-9.]+).txt/, 1]
line.chomp!
line, comment = line.split(/ *#/)
diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb
index 6f2576cc37..65339ba2db 100755
--- a/tool/enc-unicode.rb
+++ b/tool/enc-unicode.rb
@@ -59,7 +59,7 @@ def parse_unicode_data(file)
data = {'Any' => (0x0000..0x10ffff).to_a, 'Assigned' => [],
'ASCII' => (0..0x007F).to_a, 'NEWLINE' => [0x0a], 'Cn' => []}
beg_cp = nil
- IO.foreach(file) do |line|
+ File.foreach(file) do |line|
fields = line.split(';')
cp = fields[0].to_i(16)
diff --git a/tool/extlibs.rb b/tool/extlibs.rb
index b482258a2c..887cac61eb 100755
--- a/tool/extlibs.rb
+++ b/tool/extlibs.rb
@@ -185,7 +185,7 @@ class ExtLibs
extracted = false
dest = File.dirname(list)
url = chksums = nil
- IO.foreach(list) do |line|
+ File.foreach(list) do |line|
line.sub!(/\s*#.*/, '')
if /^(\w+)\s*=\s*(.*)/ =~ line
vars[$1] = vars.expand($2)
diff --git a/tool/lib/memory_status.rb b/tool/lib/memory_status.rb
index 5e9e80a68a..60632523a8 100644
--- a/tool/lib/memory_status.rb
+++ b/tool/lib/memory_status.rb
@@ -12,7 +12,7 @@ module Memory
PROC_FILE = procfile
VM_PAT = pat
def self.read_status
- IO.foreach(PROC_FILE, encoding: Encoding::ASCII_8BIT) do |l|
+ File.foreach(PROC_FILE, encoding: Encoding::ASCII_8BIT) do |l|
yield($1.downcase.intern, $2.to_i * 1024) if VM_PAT =~ l
end
end
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index 7a447fb234..131b2a311a 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -205,7 +205,7 @@ print " CONFIG = {}\n"
print " CONFIG[\"DESTDIR\"] = DESTDIR\n"
versions = {}
-IO.foreach(File.join(srcdir, "version.h")) do |l|
+File.foreach(File.join(srcdir, "version.h")) do |l|
m = /^\s*#\s*define\s+RUBY_(PATCHLEVEL)\s+(-?\d+)/.match(l)
if m
versions[m[1]] = m[2]
@@ -226,7 +226,7 @@ IO.foreach(File.join(srcdir, "version.h")) do |l|
end
end
if versions.size != 4
- IO.foreach(File.join(srcdir, "include/ruby/version.h")) do |l|
+ File.foreach(File.join(srcdir, "include/ruby/version.h")) do |l|
m = /^\s*#\s*define\s+RUBY_API_VERSION_(\w+)\s+(-?\d+)/.match(l)
if m
versions[m[1]] ||= m[2]