some fixes for ruby 1.8.1

This commit is contained in:
Ward Wouts 2004-06-16 08:17:48 +00:00
parent 233fc507d8
commit 63d8c22721
7 changed files with 24 additions and 23 deletions

View file

@ -1,7 +1,8 @@
# $Dwarf: CHANGELOG,v 1.29 2004/06/04 09:04:45 ward Exp $
# $Dwarf: CHANGELOG,v 1.30 2004/06/04 09:29:23 ward Exp $
# $Source$
from 0.2.3 to ....
- changes to make it work with ruby 1.8.1
from 0.2.2 to 0.2.3
- notify when cachedir doesn't exist

View file

@ -1,4 +1,4 @@
# $Dwarf: uuencode.rb,v 1.5 2003/04/20 20:15:34 ward Exp $
# $Dwarf: uuencode.rb,v 1.6 2003/07/20 20:32:01 ward Exp $
# $Source$
#
@ -25,7 +25,7 @@ class << self
Debuglevel = 0
def uudecode(data, outfile=nil)
case data.type.to_s
case data.class.to_s
when "Array"
print "Calling _uudecode_array\n" if Debuglevel>0
mode, filename, body = _uudecode_array(data)
@ -37,7 +37,7 @@ def uudecode(data, outfile=nil)
print "Calling _uudecode_file\n" if Debuglevel>0
mode, filename, body = _uudecode_file(data, outfile)
else
print "Funny stuff in uudecode. Data of type \"#{data.type.to_s}\"\n"
print "Funny stuff in uudecode. Data of class \"#{data.class.to_s}\"\n"
end
return mode, filename, body
end

View file

@ -1,4 +1,4 @@
# $Dwarf: yenc.rb,v 1.8 2003/04/22 19:25:57 ward Exp $
# $Dwarf: yenc.rb,v 1.9 2003/07/20 20:32:01 ward Exp $
# $Source$
#
@ -30,7 +30,7 @@ def ydecode(data, outfile=nil)
@ymap[b]=((b-42)%256)
end
case data.type.to_s
case data.class.to_s
when "Array"
print "Calling _ydecode_array\n" if Debuglevel>0
mode, filename, body = _ydecode_array(data)
@ -42,7 +42,7 @@ def ydecode(data, outfile=nil)
print "Calling _ydecode_file\n" if Debuglevel>0
mode, filename, body = _ydecode_file(data, outfile)
else
print "Funny stuff in ydecode. Data of type \"#{data.type.to_s}\"\n"
print "Funny stuff in ydecode. Data of class \"#{data.class.to_s}\"\n"
end
return mode, filename, body
end

View file

@ -1,4 +1,4 @@
# $Dwarf: article.rb,v 1.86 2004/06/04 09:20:23 ward Exp $
# $Dwarf: article.rb,v 1.87 2004/06/07 21:47:51 ward Exp $
# $Source$
#
@ -137,7 +137,7 @@ def get_articles(cachedir=false)
range = Set::IntSpan.new("#{@connections[server]["first"]}-#{@connections[server]["last"]}")
rangelist = rechunk_runlist(range.diff(@connections[server]["skip_ids"]).run_list)
print "rangelist: #{rangelist}\n" if Debuglevel > 2
print "rangelist: #{rangelist.type.to_s}\n" if Debuglevel > 2
print "rangelist: #{rangelist.class.to_s}\n" if Debuglevel > 2
print "rangelist elements: #{range.diff(@connections[server]["skip_ids"]).elements}\n" if Debuglevel > 2
begin
unless rangelist == nil or rangelist =~ /^$/
@ -707,7 +707,7 @@ def rechunk_runlist(runlist)
end
def printerr(server)
print "Caught #{$!.type} reading from server #{server} (#{caller[0]})\n"
print "Caught #{$!.class} reading from server #{server} (#{caller[0]})\n"
print "Error: #{$!}\n"
end

View file

@ -1,4 +1,4 @@
# $Dwarf: newsrc.rb,v 1.11 2002/11/05 09:33:41 ward Exp $
# $Dwarf: newsrc.rb,v 1.12 2003/07/20 20:32:01 ward Exp $
# $Source$
#
@ -204,7 +204,7 @@ def _insert(group, options)
if options.has_key?("where")
where = options["where"]
end
arg = where.slice!(1) if where.type.to_s == "Array"
arg = where.slice!(1) if where.class.to_s == "Array"
case where.to_s
when "first"

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/ruby -w
# $Dwarf: ripnews.rb,v 1.79 2004/03/03 21:18:50 ward Exp $
# $Dwarf: ripnews.rb,v 1.80 2004/05/19 09:25:40 ward Exp $
# $Source$
#
@ -63,7 +63,7 @@ def save_file(dir, name, data)
rescue Errno::ENOENT
print "Caught Errno::ENOENT (save_file)\n"
print "Error: #{$!}\n"
print "What the #@$$ happended?\n"
print "What the *beep* happened?\n"
return false
end
when "Array"
@ -85,7 +85,7 @@ def save_file(dir, name, data)
rescue Errno::ENOENT
print "Caught Errno::ENOENT (save_file)\n"
print "Error: #{$!}\n"
print "What the #@$$ happended?\n"
print "What the *beep* happened?\n"
return false
end
else
@ -136,9 +136,9 @@ end
def parse_config(default = {})
print "Parsing config\n"
print "#{default[\"-c\"]}\n"
if FileTest.readable?("#{default[\"-c\"]}")
file = File.new("#{default[\"-c\"]}")
print "#{default['-c']}\n"
if FileTest.readable?("#{default['-c']}")
file = File.new("#{default['-c']}")
lines = file.readlines
else
lines = []
@ -466,7 +466,7 @@ def get_max_file_length(tempdir=".")
name = "a"*500
name = "#$$#{name}"
begin
file = File.new("#{tempdir}/#{name}", "w", "0644").close
file = File.new("#{tempdir}/#{name}", "w", 0644).close
File.delete("#{tempdir}/#{name}")
rescue Errno::ENAMETOOLONG
name = name[0...-1]

View file

@ -1,4 +1,4 @@
# $Dwarf: intspan.rb,v 1.13 2002/11/05 09:33:41 ward Exp $
# $Dwarf: intspan.rb,v 1.14 2003/07/20 20:32:24 ward Exp $
# $Source$
#
@ -41,8 +41,8 @@ def IntSpan.valid(run_list)
end
def copy(set_spec)
print "Copy #{set_spec.type.to_s}\n" if Debuglevel > 0
case set_spec.type.to_s
print "Copy #{set_spec.class.to_s}\n" if Debuglevel > 0
case set_spec.class.to_s
when "NilClass"
print "copy: Calling _copy_empty\n" if Debuglevel > 0
_copy_empty
@ -273,7 +273,7 @@ def elements
end
def _real_set(set_spec=nil) # converts a set specification into a set
(set_spec != nil and set_spec.type.to_s == "Set::IntSpan") ?
(set_spec != nil and set_spec.class.to_s == "Set::IntSpan") ?
set_spec :
IntSpan.new(set_spec)
end