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"
|
require "./match_data"
|
||||||
|
|
||||||
module Spectator::Matchers
|
module Spectator::Matchers
|
||||||
|
# Information about a failed match.
|
||||||
struct FailedMatchData < MatchData
|
struct FailedMatchData < MatchData
|
||||||
|
# Indicates that the match failed.
|
||||||
def matched?
|
def matched?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Description from the matcher as to why it failed.
|
||||||
getter failure_message : String
|
getter failure_message : String
|
||||||
|
|
||||||
|
# Additional information from the match that can be used to debug the problem.
|
||||||
getter values : Array(Tuple(Symbol, String))
|
getter values : Array(Tuple(Symbol, String))
|
||||||
|
|
||||||
|
# Creates the match data.
|
||||||
def initialize(@failure_message, **values)
|
def initialize(@failure_message, **values)
|
||||||
@values = values.to_a
|
@values = values.to_a
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
module Spectator::Matchers
|
module Spectator::Matchers
|
||||||
|
# Information about the outcome of a match.
|
||||||
abstract struct MatchData
|
abstract struct MatchData
|
||||||
|
# Indicates whether the match as successful or not.
|
||||||
abstract def matched? : Bool
|
abstract def matched? : Bool
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
require "./match_data"
|
require "./match_data"
|
||||||
|
|
||||||
module Spectator::Matchers
|
module Spectator::Matchers
|
||||||
|
# Information about a successful match.
|
||||||
struct SuccessfulMatchData < MatchData
|
struct SuccessfulMatchData < MatchData
|
||||||
|
# Indicates that the match succeeded.
|
||||||
def matched?
|
def matched?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue