You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: base.rb
    path of file: ./repos/all_futures/lib/all_futures
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module AllFutures
  class Base < Acti
    
    def initialize(attributes = {}, &block)
      attributes ||= {}
      attributes = attributes.attributes.transform_keys(&:to_sym) if attributes.is_a?(ActiveRecord::Base)
      attributes_for_super = attributes.key?(:id) ? attributes.except(:id).except(:created_at).except(:updated_at) : attributes

      super(attributes_for_super) do
        @id = attributes&.fetch(:id, nil) || ULID.generate
        @created_at = Time.current
        @updated_at = attributes&.fetch(:updated_at, Time.current)
        @redis_key = "#{self.class.name}:#{@id}"
        @new_record = !self.class.exists?(@id)
        @destroyed = false
        @previously_new_record = false
        @_versioning_enabled = self.class.versioning
        @_versions = {}
        @_current_version = nil
        @_id_set = attributes.key?(:id)

        @attributes.keys.each do |attr|
          define_singleton_method("#{attr}_changed?") { attribute_changed?(attr) }
          define_singleton_method("#{attr}_valid?") { attribute_valid?(attr) }
          define_singleton_method("rollback_#{attr}") { rollback_attribute(attr) }
          define_singleton_method("rollback_#{attr}!") { rollback_attribute!(attr) }
          define_singleton_method("restore_#{attr}") { restore_attribute(attr) }
          define_singleton_method("restore_#{attr}!") { restore_attribute(attr) }
        end

        block&.call(self)
      end
    end