Class: Inspec::Reporters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/reporters/base.rb

Direct Known Subclasses

CLI, Json, JsonMin, Junit

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Base

Returns a new instance of Base.



5
6
7
8
# File 'lib/inspec/reporters/base.rb', line 5

def initialize(config)
  @run_data = config[:run_data]
  @output = ''
end

Instance Attribute Details

#run_dataObject (readonly)

Returns the value of attribute run_data.



3
4
5
# File 'lib/inspec/reporters/base.rb', line 3

def run_data
  @run_data
end

Instance Method Details

#output(str, newline = true) ⇒ Object



10
11
12
13
# File 'lib/inspec/reporters/base.rb', line 10

def output(str, newline = true)
  @output << str
  @output << "\n" if newline
end

#renderObject

each reporter must implement #render

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/inspec/reporters/base.rb', line 20

def render
  raise NotImplementedError, "#{self.class} must implement a `#render` method to format its output."
end

#rendered_outputObject



15
16
17
# File 'lib/inspec/reporters/base.rb', line 15

def rendered_output
  @output
end