Class: Matchi::BeAnInstanceOf
- Inherits:
-
Object
- Object
- Matchi::BeAnInstanceOf
- Defined in:
- lib/matchi/be_an_instance_of.rb
Overview
Exact type matcher: passes when the class of the actual value is the expected class itself, not a descendant.
The class of the actual value is read with Kernel#class bound to it, so
an object that redefines class cannot lie, and a BasicObject is
handled. The expected class can be given directly, or by name; see
Constant.
Instance Method Summary collapse
-
#initialize(expected) ⇒ BeAnInstanceOf
constructor
A new instance of BeAnInstanceOf.
- #match? ⇒ Boolean
- #to_s ⇒ String
Constructor Details
#initialize(expected) ⇒ BeAnInstanceOf
Returns a new instance of BeAnInstanceOf.
20 21 22 |
# File 'lib/matchi/be_an_instance_of.rb', line 20 def initialize(expected) @expected = Constant.normalize(expected, ::Class) end |