Module: Dalliance::Glue::ClassMethods

Defined in:
lib/dalliance.rb

Instance Method Summary collapse

Instance Method Details

#dalliance(dalliance_method, options = {}) ⇒ Object

Enables dalliance processing for this class.

Parameters:

  • dalliance_method (Symbol|String)

    the name of the method to call when processing the model in dalliance

  • options (Hash) (defaults to: {})

    an optional hash of options for dalliance processing

Options Hash (options):

  • :reprocess_method (Symbol)

    the name of the method to use to reprocess the model in dalliance

  • :dalliance_process_meter (Boolean)

    whether or not to display a progress meter

  • :queue (String)

    the name of the worker queue to use. Default ‘dalliance’

  • :duration_column (String)

    the name of the table column that stores the dalliance processing time. Default ‘dalliance_duration’

  • :logger (Object)

    the logger object to use. Can be nil

  • :error_notifier (Proc)

    A proc that accepts an error object. Default is a NOP



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/dalliance.rb', line 449

def dalliance(dalliance_method, options = {})
  opts = Dalliance.options.merge(options)

  opts[:dalliance_method] = dalliance_method

  if dalliance_options.nil?
    self.dalliance_options = {}
  else
    self.dalliance_options = self.dalliance_options.dup
  end

  self.dalliance_options.merge!(opts)

  include Dalliance
end

#dalliance_optionsObject



465
466
467
# File 'lib/dalliance.rb', line 465

def dalliance_options
  self.dalliance_options
end