Class: AISpec::Core::Reporters::Base

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

Direct Known Subclasses

Console, HTML, JSONReporter, JUnit, Markdown

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results, output_io: $stdout) ⇒ Base

Returns a new instance of Base.



23
24
25
26
# File 'lib/aispec/core/reporters/base.rb', line 23

def initialize(results, output_io: $stdout)
  @results = results
  @output_io = output_io
end

Class Attribute Details

.registryObject (readonly)

Returns the value of attribute registry.



10
11
12
# File 'lib/aispec/core/reporters/base.rb', line 10

def registry
  @registry
end

Instance Attribute Details

#output_ioObject (readonly)

Returns the value of attribute output_io.



21
22
23
# File 'lib/aispec/core/reporters/base.rb', line 21

def output_io
  @output_io
end

#resultsObject (readonly)

Returns the value of attribute results.



21
22
23
# File 'lib/aispec/core/reporters/base.rb', line 21

def results
  @results
end

Class Method Details

.get(name) ⇒ Object



16
17
18
# File 'lib/aispec/core/reporters/base.rb', line 16

def get(name)
  @registry[name.to_s.downcase] || Console
end

.register(name, reporter_class) ⇒ Object



12
13
14
# File 'lib/aispec/core/reporters/base.rb', line 12

def register(name, reporter_class)
  @registry[name.to_s.downcase] = reporter_class
end

Instance Method Details

#renderObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/aispec/core/reporters/base.rb', line 28

def render
  raise NotImplementedError, "#{self.class.name} must implement #render"
end