class Ikra::Types::ArrayType

Attributes

inner_type[R]

Public Class Methods

new(inner_type) click to toggle source

Ensure singleton per class

# File lib/types/types/array_type.rb, line 12
def new(inner_type)
    if @cache == nil
        @cache = {}
        @cache.default_proc = proc do |hash, key|
            hash[key] = new_original(key)
        end
    end

    return @cache[inner_type]
end
Also aliased as: new_original
new(inner_type) click to toggle source
# File lib/types/types/array_type.rb, line 30
def initialize(inner_type)
    if not inner_type.is_union_type?
        raise AssertionError.new("Union type expected")
    end

    @inner_type = inner_type
end
new_original(inner_type)
Alias for: new

Public Instance Methods

==(other) click to toggle source
# File lib/types/types/array_type.rb, line 26
def ==(other)
    return other.class == self.class && other.inner_type == self.inner_type
end
to_c_type() click to toggle source
# File lib/types/types/array_type.rb, line 42
def to_c_type
    return "#{@inner_type.to_c_type} *"
end
to_ffi_type() click to toggle source
# File lib/types/types/array_type.rb, line 46
def to_ffi_type
    return :pointer
end
to_ruby_type() click to toggle source
# File lib/types/types/array_type.rb, line 50
def to_ruby_type
    return ::Array
end
to_s() click to toggle source
# File lib/types/types/array_type.rb, line 38
def to_s
    return "[#{self.class.to_s}, inner_type = #{inner_type}]"
end