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.



34
35
36
# File 'lib/spec/mocks/argument_matchers.rb', line 34

def initialize(regexp)
  @regexp = regexp
end

Instance Method Details

#==(value) ⇒ Object



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

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