class ActiveStorage::Attached::Changes::PurgeOne

:nodoc:

def initialize(name, record, attachment)

def initialize(name, record, attachment)
  @name, @record, @attachment = name, record, attachment
end

def purge

def purge
  attachment&.purge
  reset
end

def purge_later

def purge_later
  attachment&.purge_later
  reset
end

def reset

def reset
  record.attachment_changes.delete(name)
  record.public_send("#{name}_attachment=", nil)
end