3 BANNERS.reject do |_k, v|
6 parsed = enddate && Date.parse(enddate)
10 parsed.is_a?(Date) && parsed.past?
14 # returns the least recently seen banner that is not hidden
16 banners = active_banners
21 banners.each do |k, v|
22 ckey = cookie_id(v[:id]).to_sym
23 cval = cookies[ckey] || 0
24 next if cval == "hide"
26 # rotate all banner queue positions
28 cookies[ckey] = index - 1 if index > 0
30 # pick banner with mininum queue position
31 next if index > min_index
38 unless banner_key.nil?
39 cookies[cookie_key] = banners.length # bump to end of queue