Class: Luban::Deployment::Worker::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/luban/deployment/worker/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task) ⇒ Task

Returns a new instance of Task.



12
13
14
15
16
17
# File 'lib/luban/deployment/worker/task.rb', line 12

def initialize(task)
  @cmd = task[:cmd]
  @args = OpenStruct.new(task[:args])
  @opts = OpenStruct.new(task[:opts])
  @result = OpenStruct.new
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



8
9
10
# File 'lib/luban/deployment/worker/task.rb', line 8

def args
  @args
end

#cmdObject (readonly)

Returns the value of attribute cmd.



7
8
9
# File 'lib/luban/deployment/worker/task.rb', line 7

def cmd
  @cmd
end

#optsObject (readonly)

Returns the value of attribute opts.



9
10
11
# File 'lib/luban/deployment/worker/task.rb', line 9

def opts
  @opts
end

#resultObject (readonly)

Returns the value of attribute result.



10
11
12
# File 'lib/luban/deployment/worker/task.rb', line 10

def result
  @result
end

Instance Method Details

#to_hObject



19
20
21
# File 'lib/luban/deployment/worker/task.rb', line 19

def to_h
  { cmd: cmd, args: args.to_h, opts: opts.to_h, result: result.to_h }
end