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: token.rb
    path of file: ./repos/foreman/app/models/concerns/hostext
    
    the code of the file until where you have to start completion: module Hostext
  module Token
    extend ActiveSupport::Concern

    included do
      has_one :token, :foreign_key => :host_id, :dependent => :destroy, :inver
    
    def set_token
      return unless Setting[:token_duration] != 0
      value = Foreman.uuid
      expires = Time.now.utc + Setting[:token_duration].minutes
      logger.debug do
        # improve debugging options but avoid leaking the token via logs
        sha = Digest::SHA256.hexdigest(value)
        "Building token starting with #{value[0..5]} SHA256:#{sha}"
      end
      build_token(:value => value, :expires => expires)
    end