class Ikra::Symbolic::ArrayCommand::ClassMethods::WeakCache

TODO: Check what was wrong with the subclassed Hash…

Public Class Methods

new() click to toggle source
# File lib/types/types/array_command_type.rb, line 15
def initialize
    @values = []
end

Public Instance Methods

add_value(value) click to toggle source
# File lib/types/types/array_command_type.rb, line 33
def add_value(value)
    @values.push(WeakRef.new(value))
end
get_value(value) click to toggle source
# File lib/types/types/array_command_type.rb, line 19
def get_value(value)
    @values.delete_if do |obj|
        begin
            if obj == value
                return obj.__getobj__
            end
        rescue WeakRef::RefError
            true
        end
    end

    raise RuntimeError.new("Value not found")
end
include?(value) click to toggle source
# File lib/types/types/array_command_type.rb, line 37
def include?(value)
    @values.delete_if do |obj|
        begin
            if obj == value
                return true
            end
        rescue WeakRef::RefError
            true
        end
    end

    return false
end