Class: Matchi::Matchers::Match::Matcher
- Inherits:
-
Object
- Object
- Matchi::Matchers::Match::Matcher
- Includes:
- Matchi::MatchersBase
- Defined in:
- lib/matchi/matchers/match.rb
Overview
The matcher.
Instance Method Summary collapse
-
#initialize(expected) ⇒ Matcher
constructor
Initialize the matcher with an instance of Regexp.
-
#matches? ⇒ Boolean
Boolean comparison between the actual value and the expected value.
Methods included from Matchi::MatchersBase
Constructor Details
#initialize(expected) ⇒ Matcher
Initialize the matcher with an instance of Regexp.
20 21 22 |
# File 'lib/matchi/matchers/match.rb', line 20 def initialize(expected) @expected = expected end |
Instance Method Details
#matches? ⇒ Boolean
Boolean comparison between the actual value and the expected value.
34 35 36 |
# File 'lib/matchi/matchers/match.rb', line 34 def matches?(*, **) @expected.match(yield).nil?.equal?(false) end |