Class: Yadriggy::CommonSuperType
Overview
The most specific common super type.
A value of this type is either an instance of self.type
or a subclass of self.type
.
Instance Attribute Summary collapse
-
#type ⇒ Module
readonly
The common super type.
Instance Method Summary collapse
-
#initialize(t) ⇒ CommonSuperType
constructor
A new instance of CommonSuperType.
-
#name ⇒ String
Obtains the name of this type.
-
#supertype ⇒ CommonSuperType|nil
The CommonSuperType for the super class.
Methods inherited from Type
#!=, #copy, #eql?, error_found!, #exact_type, #has_role?, role
Constructor Details
#initialize(t) ⇒ CommonSuperType
Returns a new instance of CommonSuperType.
243 244 245 |
# File 'lib/yadriggy/type.rb', line 243 def initialize(t) @type = t end |
Instance Attribute Details
#type ⇒ Module (readonly)
Returns the common super type.
240 241 242 |
# File 'lib/yadriggy/type.rb', line 240 def type @type end |
Instance Method Details
#name ⇒ String
Obtains the name of this type.
287 288 289 |
# File 'lib/yadriggy/type.rb', line 287 def name @type.name + '+' end |
#supertype ⇒ CommonSuperType|nil
Returns the Yadriggy::CommonSuperType for the super class.
277 278 279 280 281 282 283 |
# 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 |