Array#nitems is gone in ruby 1.9, changed rbot code to use
Array.compact.size, which works in both 1.8 & 1.9
end
else
# random quote
- return @lists[channel].compact[rand(@lists[channel].nitems)],
+ return @lists[channel].compact.pick_one,
@lists[channel].length - 1
end
end
raise "Botmodule #{botmodule.name} tried to unmap #{tmpl.inspect} that was handled by #{tmpl.botmodule}" unless tmpl.botmodule == botmodule.name
debug "Unmapping #{tmpl.inspect}"
@templates[handle] = nil
- @templates.clear unless @templates.nitems > 0
+ @templates.clear unless @templates.compact.size > 0
end
# We redefine the handle() method from MessageMapper, taking into account