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 Attribute Summary
Attributes included from Fieldable
Instance Method Summary collapse
-
#initialize(kvs = {}) ⇒ Job
constructor
A new instance of Job.
-
#method_missing(meth, *args, &block) ⇒ Object
–}}}.
-
#to_yaml ⇒ Object
–}}}.
Methods included from ArrayFields
#[], #[]=, #at, #delete_at, #each_key, #each_pair, #each_value, #each_with_field, #fetch, #fill, #has_key?, #has_value?, #indexes, #indices, #invert, #key?, #keys, #member?, #replace, #slice, #slice!, #store, #to_h, #to_hash, #update, #value?, #values, #values_at, version
Methods inherited from Array
Methods included from Fieldable
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/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/job.rb', line 43 def to_yaml to_hash.to_yaml end |