Class: Spec::Mocks::ArgumentConstraints::RegexpConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb

Instance Method Summary collapse

Constructor Details

#initialize(regexp) ⇒ RegexpConstraint

Returns a new instance of RegexpConstraint.



38
39
40
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 38

def initialize(regexp)
  @regexp = regexp
end

Instance Method Details

#==(value) ⇒ Object



42
43
44
45
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/argument_constraints.rb', line 42

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