Override === to call includes?

Allows the use of a filter in pattern matching scenarios (select).
This commit is contained in:
Michael Miller 2021-05-08 23:33:59 -06:00
parent e7c3d8f060
commit f2459cfe94
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436

View file

@ -5,5 +5,10 @@ module Spectator
abstract class ExampleFilter
# Checks if an example is in the filter, and should be run.
abstract def includes?(example : Example) : Bool
# :ditto:
def ===(example : Example)
includes?(example)
end
end
end