instance method
cache_sweeper
Ruby on Rails 1.1.6
Since v1.0.3 Last seen in v2.2.3Signature
cache_sweeper(watches: nil)
Returns an instance ActiveSupport::EventedFileUpdateChecker configured to clear the cache of the map when the directories passed on initialization via watches: have changes. This is used in development and test to ensure the map caches are reset when javascript files are changed.
Parameters
-
watcheskey = nil
Source
# File lib/importmap/map.rb, line 75
def cache_sweeper(watches: nil)
if watches
@cache_sweeper =
Rails.application.config.file_watcher.new([], Array(watches).collect { |dir| [ dir.to_s, "js"] }.to_h) do
clear_cache
end
else
@cache_sweeper
end
end
Defined in lib/importmap/map.rb line 75
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Importmap::Map