W3cubDocs

/Ruby on Rails 4.2

module ActiveJob::Core

Public Class Methods

new(*arguments) Show source

Creates a new job instance. Takes the arguments that will be passed to the perform method.

# File activejob/lib/active_job/core.rb, line 59
def initialize(*arguments)
  @arguments  = arguments
  @job_id     = SecureRandom.uuid
  @queue_name = self.class.queue_name
end

Public Instance Methods

serialize() Show source

Returns a hash with the job data that can safely be passed to the queueing adapter.

# File activejob/lib/active_job/core.rb, line 67
def serialize
  {
    'job_class'  => self.class.name,
    'job_id'     => job_id,
    'queue_name' => queue_name,
    'arguments'  => serialize_arguments(arguments),
    'locale'     => I18n.locale
  }
end

© 2004–2017 David Heinemeier Hansson
Licensed under the MIT License.