From 0e957bb466fe0c46e2f53510cec34c25b94a410e Mon Sep 17 00:00:00 2001 From: Andrew Carroll Date: Sat, 6 Dec 2014 21:01:57 -0800 Subject: [PATCH] Change regex style to account for no matches --- lib/lonely_coder/search.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lonely_coder/search.rb b/lib/lonely_coder/search.rb index 23b5d32..0ef9940 100644 --- a/lib/lonely_coder/search.rb +++ b/lib/lonely_coder/search.rb @@ -133,7 +133,7 @@ def results # Stores the OKCupid server timestamp. Without this, pagination returns # inconsistent results. - @timekey = page.search('script')[0].text.match(/CurrentGMT = new Date\(([\d]+)\*[\d]+\)/).captures[0] + @timekey = page.search('script')[0].text[/CurrentGMT = new Date\(([\d]+)\*[\d]+\)/, 0] # OKCupid may return previously found profiles if there aren't enough # to fill a query or pagination, so we stop that with a set.