Module: ResqueExtensions

Defined in:
lib/resque_extensions.rb,
lib/resque_extensions/version.rb,
lib/resque_extensions/async_method.rb

Defined Under Namespace

Modules: ObjectMethods Classes: AsyncMethod

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.asyncObject

Whether or not we should be running asynchronously



10
11
12
13
14
15
16
17
# File 'lib/resque_extensions.rb', line 10

def self.async
  # if we have never set @async, we default
  # to true
  if @async.nil?
    @async = true
  end
  return @async
end

.async=(new_val) ⇒ Object

Whether or not we should be running asynchronously

Examples:

ResqueExtensions.async = false
MyInstance.async(:do_something) # => calls synchronously


25
26
27
# File 'lib/resque_extensions.rb', line 25

def self.async=(new_val)
  @async = new_val
end

.enqueue_class_method(klass, *args) ⇒ Object



29
30
31
32
# File 'lib/resque_extensions.rb', line 29

def self.enqueue_class_method(klass, *args)
  klass = "#{AsyncMethod::CLASS_PREFIX}#{klass}"
  AsyncMethod.new(klass, *args).enqueue!
end