Class: Creeper::Extensions::DelayedModel

Inherits:
Object
  • Object
show all
Includes:
Worker
Defined in:
lib/creeper/extensions/active_record.rb

Overview

Adds a ‘delay’ method to ActiveRecord to offload arbitrary method execution to Creeper. Examples:

User.delay.delete_inactive User.recent_signups.each { |user| user.delay.mark_as_awesome }

Instance Method Summary collapse

Methods included from Worker

included, #logger

Instance Method Details

#perform(yml) ⇒ Object



14
15
16
17
# File 'lib/creeper/extensions/active_record.rb', line 14

def perform(yml)
  (target, method_name, args) = YAML.load(yml)
  target.send(method_name, *args)
end