Many more Rubocop-inspired code improvements

This commit is contained in:
Maruno17
2021-12-18 19:06:22 +00:00
parent d17fc40a47
commit 13a238cc6a
107 changed files with 651 additions and 652 deletions

View File

@@ -240,8 +240,6 @@ module RTP
yield ".".gsub(/[\/\\]/, "/").gsub(/[\/\\]$/, "") + "/"
end
private
def self.getSaveFileName(fileName)
File.join(getSaveFolder, fileName)
end
@@ -260,15 +258,15 @@ end
module FileTest
Image_ext = ['.png', '.gif'] # '.jpg', '.jpeg', '.bmp',
Audio_ext = ['.mid', '.midi', '.ogg', '.wav', '.wma'] # '.mp3'
IMAGE_EXTENSIONS = ['.png', '.gif'] # '.jpg', '.jpeg', '.bmp',
AUDIO_EXTENSIONS = ['.mid', '.midi', '.ogg', '.wav', '.wma'] # '.mp3'
def self.audio_exist?(filename)
return RTP.exists?(filename, Audio_ext)
return RTP.exists?(filename, AUDIO_EXTENSIONS)
end
def self.image_exist?(filename)
return RTP.exists?(filename, Image_ext)
return RTP.exists?(filename, IMAGE_EXTENSIONS)
end
end
@@ -485,8 +483,6 @@ class StringInput
@pos += 1 if @pos == @string.size
str
end
def read_all; read(); end
alias read_all read
alias sysread read
end

View File

@@ -6,8 +6,8 @@
def pbPostData(url, postdata, filename = nil, depth = 0)
if url[/^http:\/\/([^\/]+)(.*)$/]
host = $1
path = $2
path = "/" if path.length == 0
# path = $2
# path = "/" if path.length == 0
userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
body = postdata.map { |key, value|
keyString = key.to_s