Module: Rapid::Job::ClassMethods

Defined in:
lib/rapid/job.rb

Instance Method Summary collapse

Instance Method Details

#rapid(attr = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rapid/job.rb', line 9

def rapid attr={}
  job = Rapid::Task.new self.to_s, nil, attr
  methods = self.public_methods - self.superclass.methods
  methods.each do |method_name|
    job.metaclass.send(:define_method, method_name) do |*args|
      self.method_name= method_name
      self.args= args
      self.enqueue
      self
    end
  end
  job
end