Class: Matchi::Matcher::Match
Overview
**Regular expressions** matcher.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(expected) ⇒ Match
constructor
Initialize the matcher with an instance of Regexp.
-
#matches? ⇒ Boolean
Boolean comparison between the actual value and the expected value.
Methods inherited from Base
Constructor Details
#initialize(expected) ⇒ Match
Initialize the matcher with an instance of Regexp.
15 16 17 |
# File 'lib/matchi/matcher/match.rb', line 15 def initialize(expected) @expected = expected end |
Instance Method Details
#matches? ⇒ Boolean
Boolean comparison between the actual value and the expected value.
29 30 31 |
# File 'lib/matchi/matcher/match.rb', line 29 def matches?(*, **) expected.match(yield).nil?.equal?(false) end |