class T::Types::ClassOf
Validates that an object belongs to the specified class.
Attributes
type[R]
Public Class Methods
new(type)
click to toggle source
# File lib/types/types/class_of.rb, line 9 def initialize(type) @type = type end
Public Instance Methods
describe_obj(obj)
click to toggle source
@override Base
# File lib/types/types/class_of.rb, line 34 def describe_obj(obj) obj.inspect end
name()
click to toggle source
@override Base
# File lib/types/types/class_of.rb, line 14 def name "T.class_of(#{@type})" end
subtype_of_single?(other)
click to toggle source
@override Base
# File lib/types/types/class_of.rb, line 24 def subtype_of_single?(other) case other when ClassOf @type <= other.type else false end end
valid?(obj)
click to toggle source
@override Base
# File lib/types/types/class_of.rb, line 19 def valid?(obj) obj.is_a?(Module) && obj <= @type end