Class: ChefCore::CLIUX::StatusReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_core/cliux/status_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(ui_element, prefix: nil, key: nil) ⇒ StatusReporter

Returns a new instance of StatusReporter.



22
23
24
25
26
# File 'lib/chef_core/cliux/status_reporter.rb', line 22

def initialize(ui_element, prefix: nil, key: nil)
  @ui_element = ui_element
  @key = key
  @ui_element.update(prefix: prefix)
end

Instance Method Details

#error(msg) ⇒ Object



37
38
39
40
# File 'lib/chef_core/cliux/status_reporter.rb', line 37

def error(msg)
  update(msg)
  @ui_element.error
end

#success(msg) ⇒ Object



32
33
34
35
# File 'lib/chef_core/cliux/status_reporter.rb', line 32

def success(msg)
  update(msg)
  @ui_element.success
end

#update(msg) ⇒ Object



28
29
30
# File 'lib/chef_core/cliux/status_reporter.rb', line 28

def update(msg)
  @ui_element.update({ @key => msg })
end