lib/pigeon/queue.rb
# Returns the next task from the queue. If a filter_name is given, then will
# only select tasks matching that filter's conditions. An optional block
# can also be used to further restrict the qualifying tasks. The task will
# be removed from the queue and must be re-inserted if it is to be scheduled
# again.
Returns the next task from the queue. If a filter_name is given, then will
only select tasks matching that filter's conditions. An optional block
can also be used to further restrict the qualifying tasks. The task will
be removed from the queue and must be re-inserted if it is to be scheduled
again.
Returns the next task from the queue . If a filter_name is given then will only select tasks matching that filter ' s conditions . An optional block can also be used to further restrict the qualifying tasks . The task will be removed from the queue and must be re - inserted if it is to be scheduled again .
def pop(filter_name = nil, &block)
    @filters.synchronize do
      task =
        if (block_given?)
          @tasks.find(&block)
        elsif (filter_name)
          @next_task[filter_name] || begin
            filter_proc = @filters[filter_name]
            filter_proc and @tasks.find(&filter_proc)
          end
        else
          @tasks.first
        end
      if (task)
        @tasks.delete(task)
        @next_task.each do |_filter_name, next_task|
          if (task == next_task)
            @next_task[_filter_name] = nil
          end
        end
      end
      task
    end
  end
def pop ( filter_name = nil , & block ) @filters . synchronize do task = if ( block_given? ) @tasks . find ( & block ) elsif ( filter_name ) @next_task [ filter_name ] || begin filter_proc = @filters [ filter_name ] filter_proc and @tasks . find ( & filter_proc ) end else @tasks . first end if ( task ) @tasks . delete ( task ) @next_task . each do | _filter_name , next_task | if ( task == next_task ) @next_task [ _filter_name ] = nil end end end task end end
Returns the next task from the queue.
Returns the next task from the queue .
filter_name
block