Class: ChefCore::CLIUX::UI::Terminal::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_core/cliux/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.



24
25
26
27
28
29
# File 'lib/chef_core/cliux/ui/terminal/job.rb', line 24

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.



23
24
25
# File 'lib/chef_core/cliux/ui/terminal/job.rb', line 23

def exception
  @exception
end

#prefixObject (readonly)

Returns the value of attribute prefix.



23
24
25
# File 'lib/chef_core/cliux/ui/terminal/job.rb', line 23

def prefix
  @prefix
end

#procObject (readonly)

Returns the value of attribute proc.



23
24
25
# File 'lib/chef_core/cliux/ui/terminal/job.rb', line 23

def proc
  @proc
end

#target_hostObject (readonly)

Returns the value of attribute target_host.



23
24
25
# File 'lib/chef_core/cliux/ui/terminal/job.rb', line 23

def target_host
  @target_host
end

Instance Method Details

#run(reporter) ⇒ Object



31
32
33
34
35
36
# File 'lib/chef_core/cliux/ui/terminal/job.rb', line 31

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