Class: Matchi::Matcher::BeInstanceOf
- Inherits:
-
Base
- Object
- Base
- Matchi::Matcher::BeInstanceOf
- Defined in:
- lib/matchi/matcher/be_instance_of.rb
Overview
Type/class matcher.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(expected) ⇒ BeInstanceOf
constructor
Initialize the matcher with an object.
-
#matches? ⇒ Boolean
Comparison between actual and expected values.
Constructor Details
#initialize(expected) ⇒ BeInstanceOf
Initialize the matcher with an object.
17 18 19 |
# File 'lib/matchi/matcher/be_instance_of.rb', line 17 def initialize(expected) @expected = expected end |
Instance Method Details
#matches? ⇒ Boolean
TODO:
For security reasons, instead of comparing actual with expected, we should compare expected with actual. Using something such as: ‘expected.class_of?(actual)`.
Returns Comparison between actual and expected values.
33 34 35 |
# File 'lib/matchi/matcher/be_instance_of.rb', line 33 def matches? yield.instance_of?(expected) end |