Class: RR::WildcardMatchers::Satisfy
- Inherits:
-
Object
- Object
- RR::WildcardMatchers::Satisfy
- Defined in:
- lib/rr/wildcard_matchers/satisfy.rb
Instance Attribute Summary collapse
-
#expectation_proc ⇒ Object
readonly
Returns the value of attribute expectation_proc.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(expectation_proc) ⇒ Satisfy
constructor
A new instance of Satisfy.
- #inspect ⇒ Object
- #wildcard_match?(other) ⇒ Boolean
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_proc ⇒ Object (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?
19 20 21 22 |
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 19 def ==(other) return false unless other.is_a?(self.class) self.expectation_proc == other.expectation_proc end |
#inspect ⇒ Object
15 16 17 |
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 15 def inspect "satisfy {block}" end |
#wildcard_match?(other) ⇒ Boolean
10 11 12 13 |
# File 'lib/rr/wildcard_matchers/satisfy.rb', line 10 def wildcard_match?(other) return true if self == other !!expectation_proc.call(other) end |