Class: Ramcrest::Comparable::Matcher
- Inherits:
-
Object
- Object
- Ramcrest::Comparable::Matcher
show all
- Includes:
- Matcher
- Defined in:
- lib/ramcrest/comparable.rb
Instance Method Summary
collapse
Methods included from Matcher
#do_match, #mismatch, #success
Constructor Details
#initialize(name, operator, expected) ⇒ Matcher
26
27
28
29
30
|
# File 'lib/ramcrest/comparable.rb', line 26
def initialize(name, operator, expected)
@name = name
@operator = operator
@expected = expected
end
|
Instance Method Details
#description ⇒ Object
40
41
42
|
# File 'lib/ramcrest/comparable.rb', line 40
def description
"#{@name} <#{@expected}>"
end
|
#matches?(actual) ⇒ Boolean
32
33
34
35
36
37
38
|
# File 'lib/ramcrest/comparable.rb', line 32
def matches?(actual)
if actual.send(@operator, @expected)
success
else
mismatch("was <#{actual}>")
end
end
|