mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Use Formatters instead of Reporters (and Formatters)
This commit is contained in:
parent
f2459cfe94
commit
8a4735b9e6
4 changed files with 17 additions and 25 deletions
13
src/spectator/formatting/broadcast_formatter.cr
Normal file
13
src/spectator/formatting/broadcast_formatter.cr
Normal 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
|
|
@ -1,8 +1,7 @@
|
|||
require "../reporters"
|
||||
|
||||
module Spectator::Formatting
|
||||
abstract class Formatter < Reporters::Reporter
|
||||
def initialize(@output : IO)
|
||||
end
|
||||
# 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 Formatter
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in a new issue