Class: BatchKit::Database::JobRunArg

Inherits:
Object
  • Object
show all
Defined in:
lib/batch-kit/database/models.rb

Overview

Captures the value of all defined command-line arguments to the job

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_run, name, val) ⇒ JobRunArg

Returns a new instance of JobRunArg.



368
369
370
# File 'lib/batch-kit/database/models.rb', line 368

def initialize(job_run, name, val)
    super(job_run: job_run, job_arg_name: name, job_arg_value: val)
end

Class Method Details

.from(job_run) ⇒ Object



357
358
359
360
361
362
363
364
365
# File 'lib/batch-kit/database/models.rb', line 357

def self.from(job_run)
    job_run.job_args && job_run.job_args.each_pair do |name, val|
        v = case val
            when String, Numeric, TrueClass, FalseClass then val
            else val.inspect
            end
        JobRunArg.new(job_run.job_run_id, name, v).save
    end
end