instance method
digest
Ruby on Rails 2.1.0
Since v1.0.3 Last seen in v2.2.3Signature
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
-
resolverkeyreq
Source
# File lib/importmap/map.rb, line 68
def digest(resolver:)
Digest::SHA1.hexdigest(to_json(resolver: resolver).to_s)
end
Defined in lib/importmap/map.rb line 68
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Importmap::Map