class Yadriggy::CommonSuperType
The most specific common super type. A value of this type is either an instance of `self.type` or a subclass of `self.type`.
Attributes
type[R]
@return [Module] the common super type.
Public Class Methods
new(t)
click to toggle source
@param [Module] t the type.
# File lib/yadriggy/type.rb, line 243 def initialize(t) @type = t end
Public Instance Methods
<=(t)
click to toggle source
@api private Check the subtype relation. @param [Type] t the other type. @return [Boolean] true if `self` is equivalent to `t` or a subtype of `t`.
# File lib/yadriggy/type.rb, line 262 def <= (t) if t.is_super_of?(self) true else ct = CommonSuperType.role(t) !ct.nil? && (@type <= ct.type || @type == NilClass) end end
==(t)
click to toggle source
@api private
# File lib/yadriggy/type.rb, line 248 def == (t) CommonSuperType.role(t)&.type == @type end
get_method_object(method_name)
click to toggle source
@api private
# File lib/yadriggy/type.rb, line 272 def get_method_object(method_name) nil end
hash()
click to toggle source
@api private
# File lib/yadriggy/type.rb, line 253 def hash @type.hash + 1 end
name()
click to toggle source
Obtains the name of this type. @return [String] the type name.
# File lib/yadriggy/type.rb, line 287 def name @type.name + '+' end
supertype()
click to toggle source
@return [CommonSuperType|nil] the {CommonSuperType} for the super class.
# File lib/yadriggy/type.rb, line 277 def supertype if @type.is_a?(Class) && !@type.superclass.nil? CommonSuperType.new(@type.superclass) else nil end end