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: asset_hash.rb
    path of file: ./repos/middleman/middleman-core/lib/middleman-core/extensions
    
    the code of the file until where you have to start completion: require 'addressable/uri'
require 'middlema
    
  def manipulate_single_resource(resource)
    return unless @exts.include?(resource.ext)
    return if ignored_resource?(resource)
    return if resource.ignored?

    digest = if resource.binary?
      ::Digest::SHA1.file(resource.source_file).hexdigest[0..7]
    else
      # Render through the Rack interface so middleware and mounted apps get a shot
      response = @rack_client.get(
        Addressable::URI.encode(resource.destination_path),
        'bypass_inline_url_rewriter_asset_hash' => 'true'
      )

      raise "#{resource.path} should be in the sitemap!" unless response.status == 200

      ::Digest::SHA1.hexdigest(response.body)[0..7]
    end