Class: SuckerPunch::Backgroundable::BackgroundProxy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/sucker_punch/backgroundable/backgroundable.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(receiver, options, seconds = 0) ⇒ BackgroundProxy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BackgroundProxy.



137
138
139
140
141
# File 'lib/sucker_punch/backgroundable/backgroundable.rb', line 137

def initialize(receiver, options, seconds = 0)
  @receiver = receiver
  @options = options
  @seconds = seconds
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


143
144
145
146
147
# File 'lib/sucker_punch/backgroundable/backgroundable.rb', line 143

def method_missing(method, *args, &block)
  @receiver.method_missing(method, *args, &block) unless @receiver.respond_to?(method)
  raise ArgumentError.new("Backgrounding a method with a block argument is not supported.") if block_given?
  JobRunner.new(@receiver, method, args, @options).run(@seconds)
end