Class: Spec::Mocks::RegexpArgConstraint
- Defined in:
- lib/spec/mocks/argument_expectation.rb
Instance Method Summary collapse
-
#initialize(regexp) ⇒ RegexpArgConstraint
constructor
A new instance of RegexpArgConstraint.
- #matches?(value) ⇒ Boolean
Constructor Details
#initialize(regexp) ⇒ RegexpArgConstraint
Returns a new instance of RegexpArgConstraint.
25 26 27 |
# File 'lib/spec/mocks/argument_expectation.rb', line 25 def initialize(regexp) @regexp = regexp end |
Instance Method Details
#matches?(value) ⇒ Boolean
29 30 31 32 |
# File 'lib/spec/mocks/argument_expectation.rb', line 29 def matches?(value) return value =~ @regexp unless value.is_a?(Regexp) value == @regexp end |