Class: RQ::Job
Overview
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
Instance Method Summary collapse
-
#initialize(kvs = {}) ⇒ Job
constructor
A new instance of Job.
-
#method_missing(meth, *args, &block) ⇒ Object
–}}}.
-
#to_yaml ⇒ Object
–}}}.
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
–}}}
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rq-3.0.0/job.rb', line 26 def method_missing(meth, *args, &block) #--{{{ setpat = %r/=$/o meth = "#{ meth }" setter = meth =~ setpat meth.gsub! setpat, '' if fields.include? "#{ meth }" if setter self.send('[]=', meth, *args, &block) else self.send('[]', meth, *args, &block) end else super end #--}}} end |
Instance Method Details
#to_yaml ⇒ Object
–}}}
43 44 45 |
# File 'lib/rq-3.0.0/job.rb', line 43 def to_yaml to_hash.to_yaml end |