Class: Jobi::Message

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/jobi/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#constantize, #generate_job_id

Constructor Details

#initialize(job_class:, args:, after_run: nil) ⇒ Message

Returns a new instance of Message.



9
10
11
12
13
14
15
# File 'lib/jobi/message.rb', line 9

def initialize(job_class:, args:, after_run: nil)
  @id = generate_job_id
  @job_class = job_class
  @args = args
  @started_at = Time.now.to_f
  @after_run = after_run
end

Instance Attribute Details

#after_runObject (readonly)

Returns the value of attribute after_run.



7
8
9
# File 'lib/jobi/message.rb', line 7

def after_run
  @after_run
end

#argsObject (readonly)

Returns the value of attribute args.



7
8
9
# File 'lib/jobi/message.rb', line 7

def args
  @args
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/jobi/message.rb', line 7

def id
  @id
end

#job_classObject (readonly)

Returns the value of attribute job_class.



7
8
9
# File 'lib/jobi/message.rb', line 7

def job_class
  @job_class
end

#started_atObject (readonly)

Returns the value of attribute started_at.



7
8
9
# File 'lib/jobi/message.rb', line 7

def started_at
  @started_at
end