module Ikra::Symbolic::ArrayCommand::ClassMethods

Public Instance Methods

new(*args, **kwargs, &block) click to toggle source

Ensure that ArrayCommands are singletons. Otherwise, we have a problem, because two equal commands can have different class IDs.

Calls superclass method
# File lib/types/types/array_command_type.rb, line 78
def new(*args, **kwargs, &block)
    if @cache == nil
        @cache = WeakCache.new
    end

    new_command = super

    if @cache.include?(new_command)
        return @cache.get_value(new_command)
    else
        @cache.add_value(new_command)
        return new_command
    end
end