module SuckerPunch::Backgroundable

Backgroundable provides mechanism for executing an object's methods asynchronously.

Attributes

configuration[RW]

Public Class Methods

configure() { |configuration| ... } click to toggle source
# File lib/sucker_punch/backgroundable/config.rb, line 8
def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end
included(base) click to toggle source
# File lib/sucker_punch/backgroundable/backgroundable.rb, line 11
def self.included(base)
  base.extend(BackgroundableClassMethods)
end

Public Instance Methods

background(options = { }) click to toggle source

Allows you to background any method that has not been marked as a backgrounded method via {BackgroundableClassMethods#always_background}.

# File lib/sucker_punch/backgroundable/backgroundable.rb, line 17
def background(options = { })
  BackgroundProxy.new(self, options)
end
later(seconds, options = { }) click to toggle source

Allows you to background any method that has not been marked as a backgrounded method via {BackgroundableClassMethods#always_background}. The method will not be executed immediately, but only after 'seconds' seconds.

# File lib/sucker_punch/backgroundable/backgroundable.rb, line 24
def later(seconds, options = { })
  BackgroundProxy.new(self, options, seconds)
end