Class: Mocha::ParameterMatchers::RegexpMatches
- Defined in:
- lib/mocha/parameter_matchers/regexp_matches.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(regexp) ⇒ RegexpMatches
constructor
A new instance of RegexpMatches.
- #matches?(available_parameters) ⇒ Boolean
- #mocha_inspect ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(regexp) ⇒ RegexpMatches
Returns a new instance of RegexpMatches.
26 27 28 |
# File 'lib/mocha/parameter_matchers/regexp_matches.rb', line 26 def initialize(regexp) @regexp = regexp end |
Instance Method Details
#matches?(available_parameters) ⇒ Boolean
30 31 32 33 34 |
# File 'lib/mocha/parameter_matchers/regexp_matches.rb', line 30 def matches?(available_parameters) parameter = available_parameters.shift return false unless parameter.respond_to?(:=~) parameter =~ @regexp end |
#mocha_inspect ⇒ Object
36 37 38 |
# File 'lib/mocha/parameter_matchers/regexp_matches.rb', line 36 def mocha_inspect "regexp_matches(#{@regexp.mocha_inspect})" end |