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: compliance.rb
    path of file: ./repos/manageiq/app/models
    
    the code of the file until where you have to start completion: class Compliance < ApplicationRecord
  include Purging
  belo
    
  def self.set_compliancy(compliant, target, event, details)
    name = target.respond_to?(:name) ? target.name : "NA"
    _log.info("Marking as #{compliant ? "" : "Non-"}Compliant Object with Class: [#{target.class}], Id: [#{target.id}], Name: [#{name}]")

    comp  = create(:resource => target, :compliant => compliant, :event_type => event, :timestamp => Time.now.utc)

    details.each do |p|
      dhash = {
        :miq_policy_id     => p["id"],
        :miq_policy_desc   => p["description"],
        :miq_policy_result => p["result"]
      }

      p["conditions"].each do |c|
        dhash[:condition_id]     = c["id"]
        dhash[:condition_desc]   = c["description"]
        dhash[:condition_result] = c["result"] == "allow"
        comp.compliance_details.create(dhash)
      end
    end
  end