def read_primitive_with_ivars
      object = read

      primitive_ivars = read_hash(cache: false)

      if primitive_ivars.any? && object.is_a?(String)
        object = `new String(object)`
      end

      primitive_ivars.each do |name, value|
        if name != 'E'
          object.instance_variable_set(name, value)
        end
      end

      object
    end
def read_primitive_with_ivars
      object = read

      primitive_ivars = read_hash(cache: false)

      if primitive_ivars.any? && object.is_a?(String)
        object = `new String(object)`
      end

      primitive_ivars.each do |name, value|
        if name != 'E'
          object.instance_variable_set(name, value)
        end
      end

      object
    end
Reads a primitive object with instance variables
 (classes that have their own marshalling rules, like Array/Hash/Regexp/etc)

 @example
   arr = [100, 200, 300]
   arr.instance_variable_set(:@ivar, :value)
   arr
 is encoded as
   'I', [100, 200, 300], {:@ivar => value}