module Ikra::Types::RubyType

Defines the minimal interface for Ikra types. Instances of {UnionType} are expected in most cases.

Public Instance Methods

class_id() click to toggle source
# File lib/types/types/ruby_type.rb, line 47
def class_id
    if @class_id == nil
        @class_id = @@next_class_id
        @@next_class_id += 1
    end

    @class_id
end
eql?(other) click to toggle source
# File lib/types/types/ruby_type.rb, line 56
def eql?(other)
    return self == other
end
hash() click to toggle source
# File lib/types/types/ruby_type.rb, line 60
def hash
    # TODO: Implement
    return 0
end
inspect() click to toggle source
# File lib/types/types/ruby_type.rb, line 14
def inspect
    return to_s
end
is_primitive?() click to toggle source
# File lib/types/types/ruby_type.rb, line 26
def is_primitive?
    false
end
is_union_type?() click to toggle source
# File lib/types/types/ruby_type.rb, line 30
def is_union_type?
    false
end
should_generate_self_arg?() click to toggle source
# File lib/types/types/ruby_type.rb, line 34
def should_generate_self_arg?
    return true
end
to_array_type() click to toggle source
# File lib/types/types/ruby_type.rb, line 38
def to_array_type
    # TODO: This should probably not return a union type by default
    return ArrayType.new(self).to_union_type
end
to_c_type() click to toggle source
# File lib/types/types/ruby_type.rb, line 22
def to_c_type
    raise NotImplementedError
end
to_ruby_type() click to toggle source
# File lib/types/types/ruby_type.rb, line 18
def to_ruby_type
    raise NotImplementedError
end
to_str() click to toggle source
# File lib/types/types/ruby_type.rb, line 10
def to_str
    return to_s
end
to_union_type() click to toggle source
# File lib/types/types/ruby_type.rb, line 43
def to_union_type
    return UnionType.new(self)
end