class Antelopes::Job

Job object representation

@since 0.0.1

Attributes

jid[R]

@!attribute [r] jid

@return [String] the uuid of the job

@!attribute [r] job_class

@return [String] the class name of the job to run

@!attribute [r] job_method

@return [Symbol] the instance method to execute. nil if job_class_method is set

@!attribute [r] job_class_method

@return [Symbol] the class method to execute. nil if job_method is set

@!attribute [r] job_args

@return [Hash] arguments for the job (class) method
job_args[R]

@!attribute [r] jid

@return [String] the uuid of the job

@!attribute [r] job_class

@return [String] the class name of the job to run

@!attribute [r] job_method

@return [Symbol] the instance method to execute. nil if job_class_method is set

@!attribute [r] job_class_method

@return [Symbol] the class method to execute. nil if job_method is set

@!attribute [r] job_args

@return [Hash] arguments for the job (class) method
job_class[R]

@!attribute [r] jid

@return [String] the uuid of the job

@!attribute [r] job_class

@return [String] the class name of the job to run

@!attribute [r] job_method

@return [Symbol] the instance method to execute. nil if job_class_method is set

@!attribute [r] job_class_method

@return [Symbol] the class method to execute. nil if job_method is set

@!attribute [r] job_args

@return [Hash] arguments for the job (class) method
job_class_method[R]

@!attribute [r] jid

@return [String] the uuid of the job

@!attribute [r] job_class

@return [String] the class name of the job to run

@!attribute [r] job_method

@return [Symbol] the instance method to execute. nil if job_class_method is set

@!attribute [r] job_class_method

@return [Symbol] the class method to execute. nil if job_method is set

@!attribute [r] job_args

@return [Hash] arguments for the job (class) method
job_method[R]

@!attribute [r] jid

@return [String] the uuid of the job

@!attribute [r] job_class

@return [String] the class name of the job to run

@!attribute [r] job_method

@return [Symbol] the instance method to execute. nil if job_class_method is set

@!attribute [r] job_class_method

@return [Symbol] the class method to execute. nil if job_method is set

@!attribute [r] job_args

@return [Hash] arguments for the job (class) method

Public Class Methods

new(json_payload) click to toggle source

Initialization from json hash

@param json_payload [Hash] deserialized JSON hash @return [Job] a Job

# File lib/antelopes/job.rb, line 24
def initialize(json_payload)
  @jid = json_payload['jid']
  setup_job_attrs(json_payload['job'])
end

Private Instance Methods

setup_job_args(args) click to toggle source
# File lib/antelopes/job.rb, line 38
def setup_job_args(args)
  @job_args = Hash[args.map { |k, v| [k.to_sym, v] }]
end
setup_job_attrs(json_payload) click to toggle source
# File lib/antelopes/job.rb, line 31
def setup_job_attrs(json_payload)
  @job_class = json_payload['class']
  @job_method = json_payload['method']&.to_sym
  @job_class_method = json_payload['class_method']&.to_sym
  setup_job_args(json_payload['args'])
end