Class: Seira::Jobs

Inherits:
Object
  • Object
show all
Defined in:
lib/seira/jobs.rb

Constant Summary collapse

VALID_ACTIONS =
%w[help list delete run].freeze
SUMMARY =
"Manage your application's jobs.".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app:, action:, args:, context:) ⇒ Jobs

Returns a new instance of Jobs.



10
11
12
13
14
15
16
# File 'lib/seira/jobs.rb', line 10

def initialize(app:, action:, args:, context:)
  @app = app
  @action = action
  @context = context
  @args = args
  @job_name = args[0]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



8
9
10
# File 'lib/seira/jobs.rb', line 8

def action
  @action
end

#appObject (readonly)

Returns the value of attribute app.



8
9
10
# File 'lib/seira/jobs.rb', line 8

def app
  @app
end

#argsObject (readonly)

Returns the value of attribute args.



8
9
10
# File 'lib/seira/jobs.rb', line 8

def args
  @args
end

#contextObject (readonly)

Returns the value of attribute context.



8
9
10
# File 'lib/seira/jobs.rb', line 8

def context
  @context
end

#job_nameObject (readonly)

Returns the value of attribute job_name.



8
9
10
# File 'lib/seira/jobs.rb', line 8

def job_name
  @job_name
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/seira/jobs.rb', line 18

def run
  case action
  when 'help'
    run_help
  when 'list'
    run_list
  when 'delete'
    run_delete
  when 'run'
    run_run
  else
    fail "Unknown command encountered"
  end
end