Class: ChefCore::CLIUX::UI::Terminal::Job
- Inherits:
-
Object
- Object
- ChefCore::CLIUX::UI::Terminal::Job
- Defined in:
- lib/chef_core/cliux/ui/terminal/job.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#proc ⇒ Object
readonly
Returns the value of attribute proc.
-
#target_host ⇒ Object
readonly
Returns the value of attribute target_host.
Instance Method Summary collapse
-
#initialize(prefix, target_host, &block) ⇒ Job
constructor
A new instance of Job.
- #run(reporter) ⇒ Object
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
#exception ⇒ Object (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 |
#prefix ⇒ Object (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 |
#proc ⇒ Object (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_host ⇒ Object (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 |