Class: ChefApply::UI::Terminal::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_apply/ui/terminal/job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix, target_host, &block) ⇒ Job

Returns a new instance of Job.



23
24
25
26
27
28
# File 'lib/chef_apply/ui/terminal/job.rb', line 23

def initialize(prefix, target_host, &block)
  @proc = block
  @prefix = prefix
  @target_host = target_host
  @error = nil
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



22
23
24
# File 'lib/chef_apply/ui/terminal/job.rb', line 22

def exception
  @exception
end

#prefixObject (readonly)

Returns the value of attribute prefix.



22
23
24
# File 'lib/chef_apply/ui/terminal/job.rb', line 22

def prefix
  @prefix
end

#procObject (readonly)

Returns the value of attribute proc.



22
23
24
# File 'lib/chef_apply/ui/terminal/job.rb', line 22

def proc
  @proc
end

#target_hostObject (readonly)

Returns the value of attribute target_host.



22
23
24
# File 'lib/chef_apply/ui/terminal/job.rb', line 22

def target_host
  @target_host
end

Instance Method Details

#run(reporter) ⇒ Object



30
31
32
33
34
35
# File 'lib/chef_apply/ui/terminal/job.rb', line 30

def run(reporter)
  @proc.call(reporter)
rescue => e
  reporter.error(e.to_s)
  @exception = e
end