Module: IRB::Reload

Defined in:
lib/irb/reload.rb,
lib/irb/reload/command.rb,
lib/irb/reload/version.rb

Defined Under Namespace

Classes: Command

Constant Summary collapse

DEFAULT_PATHS =
["lib"]
WATCHCAT_FILTERS =
{
  ignore_remove: true,
  ignore_access: true
}.freeze
VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.configObject



43
44
45
# File 'lib/irb/reload.rb', line 43

def config
  IRB.conf[:RELOAD] ||= {}
end

.reload!Object



32
33
34
35
36
37
# File 'lib/irb/reload.rb', line 32

def reload!
  @changed_files.each do |file|
    reload_file(file)
  end
  @changed_files.clear
end

.startObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/irb/reload.rb', line 19

def start
  @changed_files = Set.new
  normalized_paths = normalize_paths(config[:paths] || DEFAULT_PATHS)

  @watcher&.stop if defined?(@watcher) && @watcher
  @watcher = Watchcat.watch(normalized_paths, filters: WATCHCAT_FILTERS) do |event|
    record_watchcat_event(event)
  end

  @watched_paths = normalized_paths
  true
end

.watched_pathsObject



39
40
41
# File 'lib/irb/reload.rb', line 39

def watched_paths
  @watched_paths || []
end