instance method cache_sweeper

Ruby on Rails 1.1.6

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

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

watches key = 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

Type at least 2 characters to search.

↑↓ navigate · open · esc close