Class Delayed::PerformableMethod
In: lib/delayed/performable_method.rb
Parent: Struct.new(:object, :method, :args)

Methods

display_name   new   perform  

Constants

CLASS_STRING_FORMAT = /^CLASS\:([A-Z][\w\:]+)$/
AR_STRING_FORMAT = /^AR\:([A-Z][\w\:]+)\:(\d+)$/

Public Class methods

[Source]

    # File lib/delayed/performable_method.rb, line 6
 6:     def initialize(object, method, args)
 7:       raise NoMethodError, "undefined method `#{method}' for #{self.inspect}" unless object.respond_to?(method)
 8: 
 9:       self.object = dump(object)
10:       self.args   = args.map { |a| dump(a) }
11:       self.method = method.to_sym
12:     end

Public Instance methods

[Source]

    # File lib/delayed/performable_method.rb, line 14
14:     def display_name  
15:       case self.object
16:       when CLASS_STRING_FORMAT then "#{$1}.#{method}"
17:       when AR_STRING_FORMAT    then "#{$1}##{method}"
18:       else "Unknown##{method}"
19:       end      
20:     end

[Source]

    # File lib/delayed/performable_method.rb, line 22
22:     def perform
23:       load(object).send(method, *args.map{|a| load(a)})
24:     rescue ActiveRecord::RecordNotFound
25:       # We cannot do anything about objects which were deleted in the meantime
26:       true
27:     end

[Validate]