instance method digest

Ruby on Rails 1.0.3

Since v1.0.3 Last seen in v2.2.3

Available in: v1.0.3 v1.1.6 v1.2.3 v2.0.3 v2.1.0 v2.2.3

Signature

digest(resolver:)

Returns a SHA1 digest of the import map json that can be used as a part of a page etag to ensure that a html cache is invalidated when the import map is changed.

Example:

class ApplicationController < ActionController::Base
  etag { Rails.application.importmap.digest(resolver: helpers) if request.format&.html? }
end

Parameters

resolver keyreq
Source
# File lib/importmap/map.rb, line 67
  def digest(resolver:)
    Digest::SHA1.hexdigest(to_json(resolver: resolver).to_s)
  end

Defined in lib/importmap/map.rb line 67 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Importmap::Map

Type at least 2 characters to search.

↑↓ navigate · open · esc close