Class: Jobler::Job

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/jobler/job.rb

Overview

rubocop:disable Rails/ApplicationRecord

Instance Method Summary collapse

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/jobler/job.rb', line 12

def completed?
  state == "completed"
end

#error?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/models/jobler/job.rb', line 16

def error?
  state == "error"
end

#joblerObject



8
9
10
# File 'app/models/jobler/job.rb', line 8

def jobler
  @jobler ||= jobler_type.constantize.new(args: YAML.load(parameters), job: self) # rubocop:disable Security/YAMLLoad
end

#to_paramObject



20
21
22
23
24
# File 'app/models/jobler/job.rb', line 20

def to_param
  raise "No slug" unless slug?

  slug
end