Class: Fried::Typings::IsStrictly
- Inherits:
-
Object
- Object
- Fried::Typings::IsStrictly
- Defined in:
- lib/fried/typings/is_strictly.rb
Overview
Checks if the object.class is exactly of the passed type
Instance Method Summary collapse
-
#initialize(type) ⇒ IsStrictly
constructor
A new instance of IsStrictly.
- #valid?(obj) ⇒ Boolean
Methods included from Type
Methods included from MetaType
Constructor Details
#initialize(type) ⇒ IsStrictly
17 18 19 |
# File 'lib/fried/typings/is_strictly.rb', line 17 def initialize(type) @type = type end |
Instance Method Details
#valid?(obj) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/fried/typings/is_strictly.rb', line 21 def valid?(obj) return type.valid?(obj) if type < Type obj.class == type end |