From 402c66aa5228f734e88abd7b3cdc482f71239553 Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Wed, 21 Oct 2009 18:52:41 +0300 Subject: urban: fix page detection logic numpages = s[%r{
.*?
}m].scan(/\d+/) ^ produces an error when regex returns nil --- data/rbot/plugins/urban.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/urban.rb b/data/rbot/plugins/urban.rb index f4355061..68ffadba 100644 --- a/data/rbot/plugins/urban.rb +++ b/data/rbot/plugins/urban.rb @@ -21,7 +21,9 @@ class UrbanPlugin < Plugin notfound = s.match %r{.*? isn't defined} - numpages = s[%r{
.*?
}m].scan(/\d+/).collect {|x| x.to_i}.max || 1 + numpages = if s[%r{
.*?
}m] + $&.scan(/\d+/).collect {|x| x.to_i}.max + else 1 end rv = Array.new s.scan(%r{]*>.*?(\d+)\..*?.*?(?:)?([^>]+)(?:)?.*?
(.+?)
.*?
(.+?)
}m) do |num, wrd, desc, ex| -- cgit v1.2.3