class Mocha::ParameterMatchers::RegexpMatches

Parameter matcher which matches if specified regular expression matches actual paramter.

Public Class Methods

new(regexp) click to toggle source

@private

# File lib/mocha/parameter_matchers/regexp_matches.rb, line 31
def initialize(regexp)
  @regexp = regexp
end

Public Instance Methods

matches?(available_parameters) click to toggle source

@private

# File lib/mocha/parameter_matchers/regexp_matches.rb, line 36
def matches?(available_parameters)
  parameter = available_parameters.shift
  return false unless parameter.respond_to?(:=~)
  parameter =~ @regexp
end
mocha_inspect() click to toggle source

@private

# File lib/mocha/parameter_matchers/regexp_matches.rb, line 43
def mocha_inspect
  "regexp_matches(#{@regexp.mocha_inspect})"
end