Class: ViewSpec::Reloader

Inherits:
Object
  • Object
show all
Defined in:
lib/view_spec/reloader.rb

Instance Method Summary collapse

Constructor Details

#initialize(files = [], paths = [], &callback) ⇒ Reloader

Returns a new instance of Reloader.



5
6
7
8
9
# File 'lib/view_spec/reloader.rb', line 5

def initialize(files = [], paths = [], &callback)
  paths_hash = paths.map { [_1, ["rb"]] }.to_h

  @file_watcher = ActiveSupport::FileUpdateChecker.new(files, paths_hash, &callback)
end

Instance Method Details

#updated?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/view_spec/reloader.rb', line 11

def updated?
  @file_watcher.execute_if_updated
end