Class: Spec::Mocks::ArgumentMatchers::RegexpMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/mocks/argument_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(regexp) ⇒ RegexpMatcher

Returns a new instance of RegexpMatcher.



38
39
40
# File 'lib/spec/mocks/argument_matchers.rb', line 38

def initialize(regexp)
  @regexp = regexp
end

Instance Method Details

#==(value) ⇒ Object



42
43
44
45
# File 'lib/spec/mocks/argument_matchers.rb', line 42

def ==(value)
  return value =~ @regexp unless value.is_a?(Regexp)
  value == @regexp
end