Class: Polyrun::Quick::RegexMatcher
- Inherits:
-
Object
- Object
- Polyrun::Quick::RegexMatcher
- Defined in:
- lib/polyrun/quick/matchers.rb
Instance Method Summary collapse
- #does_not_match?(actual) ⇒ Boolean
- #failure_message(actual) ⇒ Object
- #failure_message_when_negated(actual) ⇒ Object
-
#initialize(pattern) ⇒ RegexMatcher
constructor
A new instance of RegexMatcher.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(pattern) ⇒ RegexMatcher
Returns a new instance of RegexMatcher.
133 134 135 |
# File 'lib/polyrun/quick/matchers.rb', line 133 def initialize(pattern) @pattern = pattern end |
Instance Method Details
#does_not_match?(actual) ⇒ Boolean
143 144 145 |
# File 'lib/polyrun/quick/matchers.rb', line 143 def does_not_match?(actual) !matches?(actual) end |
#failure_message(actual) ⇒ Object
147 148 149 |
# File 'lib/polyrun/quick/matchers.rb', line 147 def (actual) "expected #{actual.inspect} to match #{@pattern.inspect}" end |
#failure_message_when_negated(actual) ⇒ Object
151 152 153 |
# File 'lib/polyrun/quick/matchers.rb', line 151 def (actual) "expected #{actual.inspect} not to match #{@pattern.inspect}" end |
#matches?(actual) ⇒ Boolean
137 138 139 140 141 |
# File 'lib/polyrun/quick/matchers.rb', line 137 def matches?(actual) return false unless actual.respond_to?(:to_s) @pattern === actual.to_s end |