Class: ActionView::CacheExpiry::ViewReloader
- Defined in:
- actionview/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 15 16 |
# File 'actionview/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 rebuild_watcher ActionView::PathRegistry.file_system_resolver_hooks << method(:rebuild_watcher) end |
Instance Method Details
#execute ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'actionview/lib/action_view/cache_expiry.rb', line 22 def execute watcher = nil @mutex.synchronize do @previous_change = false watcher = @watcher end watcher.execute end |
#updated? ⇒ Boolean
18 19 20 |
# File 'actionview/lib/action_view/cache_expiry.rb', line 18 def updated? @previous_change || @watcher.updated? end |