Class: InspecPlugins::StreamingReporterProgressBar::StreamingReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb

Overview

This class will provide the actual Streaming Reporter implementation. Its superclass is provided by another call to Inspec.plugin, this time with two args. The first arg specifies we are requesting version 2 of the Plugins API. The second says we are making a Streaming Reporter plugin component, so please make available any DSL needed for that.

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ StreamingReporter

Returns a new instance of StreamingReporter.



50
51
52
53
54
# File 'lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb', line 50

def initialize(output)
  @bar = nil
  @status_mapping = {}
  initialize_streaming_reporter
end

Instance Method Details

#example_failed(notification) ⇒ Object



62
63
64
65
66
# File 'lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb', line 62

def example_failed(notification)
  control_id = notification.example.[:id]
  set_status_mapping(control_id, "failed")
  show_progress(control_id) if control_ended?(control_id)
end

#example_passed(notification) ⇒ Object



56
57
58
59
60
# File 'lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb', line 56

def example_passed(notification)
  control_id = notification.example.[:id]
  set_status_mapping(control_id, "passed")
  show_progress(control_id) if control_ended?(control_id)
end

#example_pending(notification) ⇒ Object



68
69
70
71
72
# File 'lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb', line 68

def example_pending(notification)
  control_id = notification.example.[:id]
  set_status_mapping(control_id, "skipped")
  show_progress(control_id) if control_ended?(control_id)
end