lib/resque_cleaner.rb in resque-cleaner-0.2.12 vs lib/resque_cleaner.rb in resque-cleaner-0.3.0
- old
+ new
@@ -88,9 +88,15 @@
jobs = @limiter.jobs
block_given? ? @limiter.jobs.select(&block) : jobs
end
alias :failure_jobs :select
+ def select_by_regex(regex)
+ select do |job|
+ job.to_s =~ regex
+ end
+ end
+
# Clears every jobs for which block evaluates to true.
def clear(&block)
cleared = 0
@limiter.lock do
@limiter.jobs.each_with_index do |job,i|