Class: Object

Inherits:
BasicObject
Defined in:
lib/types/types/class_type.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.to_ikra_typeObject



136
137
138
139
# File 'lib/types/types/class_type.rb', line 136

def self.to_ikra_type
    # TODO: should this method be defined on Class?
    return Ikra::Types::ClassType.new(self)
end

Instance Method Details

#ikra_typeObject

Returns the [Ikra::Types::RubyType] for this object. Instance of the same Ruby class can principally have different Ikra types. Thus, this method is defined as an instance method.



143
144
145
146
147
148
149
150
# File 'lib/types/types/class_type.rb', line 143

def ikra_type
    if self.is_a?(Module)
        return self.singleton_class.to_ikra_type
    else
        # TODO: Double check if we always want to have the singleton class?
        return self.class.to_ikra_type
    end
end