super
@lists = Hash.new
@changed = Hash.new
- Dir[datafile '*'].each {|f|
+ Dir[datafile('*')].each {|f|
next if File.directory?(f)
channel = File.basename(f)
@lists[channel] = Array.new if(!@lists.has_key?(channel))
begin
if @changed[channel]
debug "Writing new quotefile for channel #{channel} ..."
- Utils.safe_save(datafile channel) {|file|
+ Utils.safe_save(datafile(channel)) {|file|
quotes.compact.each {|q|
file.puts "#{q.num} | #{q.date} | #{q.source} | #{q.quote}"
}
end
else
# random quote
- return @lists[channel].compact[rand(@lists[channel].nitems)],
+ return @lists[channel].compact.pick_one,
@lists[channel].length - 1
end
end