Class: ActionView::CacheExpiry::ViewReloader
- Inherits:
-
Object
- Object
- ActionView::CacheExpiry::ViewReloader
- Defined in:
- lib/action_view/cache_expiry.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(watcher:, &block) ⇒ ViewReloader
constructor
A new instance of ViewReloader.
- #updated? ⇒ Boolean
Constructor Details
#initialize(watcher:, &block) ⇒ ViewReloader
Returns a new instance of ViewReloader.
6 7 8 9 10 11 12 13 14 |
# File 'lib/action_view/cache_expiry.rb', line 6 def initialize(watcher:, &block) @mutex = Mutex.new @watcher_class = watcher @watched_dirs = nil @watcher = nil @previous_change = false ActionView::PathRegistry.file_system_resolver_hooks << method(:rebuild_watcher) end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/action_view/cache_expiry.rb', line 21 def execute return unless @watcher watcher = nil @mutex.synchronize do @previous_change = false watcher = @watcher end watcher.execute end |
#updated? ⇒ Boolean
16 17 18 19 |
# File 'lib/action_view/cache_expiry.rb', line 16 def updated? build_watcher unless @watcher @previous_change || @watcher.updated? end |