opal/zeitwerk/loader.rb in opal-zeitwerk-0.0.2 vs opal/zeitwerk/loader.rb in opal-zeitwerk-0.0.3
- old
+ new
@@ -129,11 +129,11 @@
@autoloads = {}
@autoloaded_dirs = []
@to_unload = {}
@lazy_subdirs = {}
@eager_load_exclusions = Set.new
-
+
@setup = false
@eager_loaded = false
@reloading_enabled = false
@@ -619,14 +619,16 @@
# @return [void]
def ls(dir)
# `console.log("dir:", dir)`
outer_ls = false
# cache the Opal.modules keys array for subsequent ls calls during setup
- if !@module_paths
- @module_paths = `Object.keys(Opal.modules)`
- outer_ls = true
- end
+ %x{
+ if (#@module_paths === nil) {
+ #@module_paths = Object.keys(Opal.modules);
+ outer_ls = true;
+ }
+ }
visited_abspaths = `{}`
dir_first_char = dir[0]
path_start = dir.size + 1
path_parts = `[]`
basename = `''`
@@ -643,12 +645,12 @@
#{yield basename, abspath unless ignored_paths.member?(abspath)}
}
}
end
# remove cache, because Opal.modules may change after setup
- if outer_ls
- @module_paths = nil
- end
+ %x{
+ if (outer_ls) { #@module_paths = nil }
+ }
end
# @param path [String]
# @return [Boolean]
def ruby?(abspath)