| In: |
lib/rq-3.0.0/job.rb
|
| Parent: | Array |
Job is a convenience class which stamps out a QDB::tuple and extends it with methods that give accessor methods for each field in the hash
# File lib/rq-3.0.0/job.rb, line 20
20: def initialize kvs = {}
21: #--{{{
22: self.fields = QDB::FIELDS
23: (kvs.keys - self.fields).each{|k| self[k] = kvs[k]}
24: #--}}}
25: end
# File lib/rq-3.0.0/job.rb, line 26
26: def method_missing(meth, *args, &block)
27: #--{{{
28: setpat = %/=$/o
29: meth = "#{ meth }"
30: setter = meth =~ setpat
31: meth.gsub! setpat, ''
32: if fields.include? "#{ meth }"
33: if setter
34: self.send('[]=', meth, *args, &block)
35: else
36: self.send('[]', meth, *args, &block)
37: end
38: else
39: super
40: end
41: #--}}}
42: end