Class: RSpec::JsonMatchers::Expectations::Private::MatchingRegexp
- Inherits:
-
Core::SingleValueCallableExpectation
- Object
- RSpec::JsonMatchers::Expectation
- Core::CallableExpectation
- Core::SingleValueCallableExpectation
- RSpec::JsonMatchers::Expectations::Private::MatchingRegexp
- Defined in:
- lib/rspec/json_matchers/expectations/private.rb
Overview
Takes exactly one object Use stored regexp for checking value
Instance Method Summary collapse
Methods inherited from Core::SingleValueCallableExpectation
Methods inherited from Core::CallableExpectation
Methods inherited from RSpec::JsonMatchers::Expectation
Instance Method Details
#expect?(value) ⇒ Boolean
104 105 106 107 108 |
# File 'lib/rspec/json_matchers/expectations/private.rb', line 104 def expect?(value) # regex =~ string seems to be fastest # @see https://stackoverflow.com/questions/11887145/fastest-way-to-check-if-a-string-matches-or-not-a-regexp-in-ruby value.is_a?(String) && regexp =~ value end |