Use Formatters instead of Reporters (and Formatters)

This commit is contained in:
Michael Miller 2021-05-08 23:35:29 -06:00
parent f2459cfe94
commit 8a4735b9e6
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436
4 changed files with 17 additions and 25 deletions

View file

@ -0,0 +1,13 @@
require "./formatter"
module Spectator::Formatting
# Reports events to multiple other formatters.
# Events received by this formatter will be sent to others.
class BroadcastFormatter < Formatter
# Creates the broadcast formatter.
# Takes a collection of formatters to pass events along to.
def initialize(formatters : Enumerable(Formatter))
@formatters = formatters.to_a
end
end
end

View file

@ -1,8 +1,7 @@
require "../reporters"
module Spectator::Formatting module Spectator::Formatting
abstract class Formatter < Reporters::Reporter # Base class and interface used to notify systems of events.
def initialize(@output : IO) # This is typically used for producing output from test results,
end # but can also be used to send data to external systems.
abstract class Formatter
end end
end end

View file

@ -1,13 +0,0 @@
require "./reporter"
module Spectator::Reporters
# Reports events to multiple other reporters.
# Events received by this reporter will be sent to others.
class BroadcastReporter < Reporter
# Creates the broadcast reporter.
# Takes a collection of reporters to pass events along to.
def initialize(reporters : Enumerable(Reporter))
@reporters = reporters.to_a
end
end
end

View file

@ -1,7 +0,0 @@
module Spectator::Reporters
# Base class and interface used to notify systems of events.
# This is typically used for producing output from test results,
# but can also be used to send data to external systems.
abstract class Reporter
end
end