fix for ruby >2.0

This commit is contained in:
Ward Wouts 2014-10-31 19:33:29 +00:00
parent f75852302f
commit 67009d7ef5
4 changed files with 25 additions and 24 deletions

View file

@ -57,7 +57,7 @@ def _uudecode_file(file, outfile)
if line =~ /^begin(.*)/
m = $1
puts "beginning matched; rest: #{m}" if Debuglevel > 0
if m =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/
if m.match(/^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/)
mode = $2
filename = $4
puts "found beginning" if Debuglevel > 0
@ -89,8 +89,8 @@ def _uudecode_file(file, outfile)
return mode, filename if line =~ /^end/
next if line =~ /[a-z]/
next if line == nil
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
outfile.print line.unpack("u")
next unless ((((line[0].ord - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
line.unpack("u").each{|x| outfile.print x}
end
puts "No \"end\" found!!!"
@ -116,7 +116,7 @@ def _uudecode_array(data)
if data[i] =~ /^begin(.*)/
m = $1
puts "beginning matched; rest: #{m}" if Debuglevel > 0
if m =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/
if m.match(/^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/)
mode = $2
filename = $4
puts "found beginning" if Debuglevel > 0
@ -149,7 +149,7 @@ def _uudecode_array(data)
next if line =~ /[a-z]/
next if line == nil
begin
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
next unless ((((line[0].ord - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
rescue NoMethodError
return false
end