Module: IRB::Reload
- Defined in:
- lib/irb/reload.rb,
lib/irb/reload/command.rb,
lib/irb/reload/version.rb,
lib/irb/reload/context_extension.rb
Defined Under Namespace
Modules: ContextExtension
Classes: Command
Constant Summary
collapse
- DEFAULT_PATHS =
["lib"]
- WATCHCAT_OPTIONS =
{
filters: { ignore_remove: true,ignore_access: true },
patterns: [ "*.rb" ],
}.freeze
- VERSION =
"0.2.0"
Class Method Summary
collapse
Class Method Details
.auto? ⇒ Boolean
40
41
42
|
# File 'lib/irb/reload.rb', line 40
def auto?
config[:auto] == true
end
|
.auto_reload! ⇒ Object
44
45
46
|
# File 'lib/irb/reload.rb', line 44
def auto_reload!
reload!(verbose: false) if auto?
end
|
.config ⇒ Object
52
53
54
|
# File 'lib/irb/reload.rb', line 52
def config
IRB.conf[:RELOAD] ||= {}
end
|
.reload!(verbose: true) ⇒ Object
34
35
36
37
38
|
# File 'lib/irb/reload.rb', line 34
def reload!(verbose: true)
consume_changed_files.each do |file|
reload_file(file, verbose:)
end
end
|
.start ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/irb/reload.rb', line 20
def start
@mutex = Mutex.new
@changed_files = Set.new
normalized_paths = normalize_paths(config[:paths] || DEFAULT_PATHS)
@watcher&.stop if defined?(@watcher) && @watcher
@watcher = Watchcat.watch(normalized_paths, **WATCHCAT_OPTIONS) do |event|
record_watchcat_event(event)
end
@watched_paths = normalized_paths
true
end
|
.watched_paths ⇒ Object
48
49
50
|
# File 'lib/irb/reload.rb', line 48
def watched_paths
@watched_paths || []
end
|