Module: Bluth::Queue

Includes:
Familia
Defined in:
lib/bluth.rb

Class Method Summary collapse

Class Method Details

.create_queue(name) ⇒ Object



113
114
115
116
117
118
119
# File 'lib/bluth.rb', line 113

def self.create_queue name
  unless queue(name)
    q = Familia::List.new name, :parent => self
    @queuecache[name.to_s.to_sym] = q
  end
  queue(name)
end

.entry_queuesObject

The subset of queues that new jobs arrive in, in order of priority



133
134
135
136
137
138
139
140
# File 'lib/bluth.rb', line 133

def entry_queues
  qs = Bluth.priority.collect { |qname| self.send qname }
  if defined?(Bluth::TimingBelt)
    notch_queues = Bluth::TimingBelt.priority.collect { |notch| notch.queue }
    qs.insert 1, *notch_queues
  end
  qs
end

.queue(name) ⇒ Object



141
142
143
144
145
146
147
148
# File 'lib/bluth.rb', line 141

def queue name
  if class_list? name.to_s.to_sym
    self.send(name)
  else
    @queuecache ||= {}
    @queuecache[name.to_s.to_sym] 
  end
end

.queuesObject

The complete list of queues in the order they were defined



122
123
124
125
126
127
128
129
130
131
# File 'lib/bluth.rb', line 122

def queues
  qs = Bluth::Queue.class_lists.collect(&:name).collect do |qname|
    self.send qname
  end
  if defined?(Bluth::TimingBelt)
    notch_queues = Bluth::TimingBelt.priority.collect { |notch| notch.queue }
    qs.insert 1, *notch_queues
  end
  qs
end