Class: ChefApply::StatusReporter

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of StatusReporter.



21
22
23
24
25
# File 'lib/chef_apply/status_reporter.rb', line 21

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



36
37
38
39
# File 'lib/chef_apply/status_reporter.rb', line 36

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

#success(msg) ⇒ Object



31
32
33
34
# File 'lib/chef_apply/status_reporter.rb', line 31

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

#update(msg) ⇒ Object



27
28
29
# File 'lib/chef_apply/status_reporter.rb', line 27

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