Class: RR::WildcardMatchers::Satisfy

Inherits:
Object
  • Object
show all
Defined in:
lib/rr/wildcard_matchers/satisfy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expectation_proc) ⇒ Satisfy

Returns a new instance of Satisfy.



6
7
8
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 6

def initialize(expectation_proc)
  @expectation_proc = expectation_proc
end

Instance Attribute Details

#expectation_procObject (readonly)

Returns the value of attribute expectation_proc.



4
5
6
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 4

def expectation_proc
  @expectation_proc
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



15
16
17
18
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 15

def ==(other)
  other.is_a?(self.class) &&
  other.expectation_proc.equal?(self.expectation_proc)
end

#inspectObject



21
22
23
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 21

def inspect
  "satisfy { ... }"
end

#wildcard_match?(other) ⇒ Boolean

Returns:



10
11
12
13
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 10

def wildcard_match?(other)
  self == other ||
  !!expectation_proc.call(other)
end