mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add match data docs
This commit is contained in:
parent
d5fd21702a
commit
c4b886cad2
3 changed files with 9 additions and 0 deletions
|
@ -1,15 +1,20 @@
|
|||
require "./match_data"
|
||||
|
||||
module Spectator::Matchers
|
||||
# Information about a failed match.
|
||||
struct FailedMatchData < MatchData
|
||||
# Indicates that the match failed.
|
||||
def matched?
|
||||
false
|
||||
end
|
||||
|
||||
# Description from the matcher as to why it failed.
|
||||
getter failure_message : String
|
||||
|
||||
# Additional information from the match that can be used to debug the problem.
|
||||
getter values : Array(Tuple(Symbol, String))
|
||||
|
||||
# Creates the match data.
|
||||
def initialize(@failure_message, **values)
|
||||
@values = values.to_a
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
module Spectator::Matchers
|
||||
# Information about the outcome of a match.
|
||||
abstract struct MatchData
|
||||
# Indicates whether the match as successful or not.
|
||||
abstract def matched? : Bool
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
require "./match_data"
|
||||
|
||||
module Spectator::Matchers
|
||||
# Information about a successful match.
|
||||
struct SuccessfulMatchData < MatchData
|
||||
# Indicates that the match succeeded.
|
||||
def matched?
|
||||
true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue