6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/quick_utils/job.rb', line 6
def job_mongo_keys!
key :jt, Integer key :pr, Integer, :default => 0 key :ip, Boolean, :default => false key :opt, Hash
attr_alias :job_type, :jt
attr_alias :priority, :pr
attr_alias :in_progress, :ip
cattr_accessor :job_types
self.job_types = {}
scope :with_job_type, lambda { |job_type|
where(:jt => job_type)
}
scope :processing, lambda {
where(:ip => true)
}
scope :unprocessed, lambda {
where(:ip => false)
}
scope :by_priority, lambda {
sort(:pr.asc)
}
timestamps!
end
|