Module: ActiveSupport::Dependencies
- Defined in:
- lib/brick/extensions.rb
Class Method Summary collapse
-
._brick_autoload_module! ⇒ Object
%%% Probably a little more targeted than other approaches we’ve taken thusfar This happens before the whole parent check.
- .autoload_module!(*args) ⇒ Object
Class Method Details
._brick_autoload_module! ⇒ Object
%%% Probably a little more targeted than other approaches we’ve taken thusfar This happens before the whole parent check
924 |
# File 'lib/brick/extensions.rb', line 924 alias _brick_autoload_module! autoload_module! |
.autoload_module!(*args) ⇒ Object
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 |
# File 'lib/brick/extensions.rb', line 925 def autoload_module!(*args) into, const_name, qualified_name, path_suffix = args if (base_class_name = ::Brick.config.sti_namespace_prefixes&.fetch("::#{into.name}::", nil)) base_class_name = "::#{base_class_name}" unless base_class_name.start_with?('::') end if (base_class = base_class_name&.constantize) ::Brick.sti_models[qualified_name] = { base: base_class } # Build subclass and place it into the specially STI-namespaced module into.const_set(const_name.to_sym, klass = Class.new(base_class)) # %%% used to also have: autoload_once_paths.include?(base_path) || autoloaded_constants << qualified_name unless autoloaded_constants.include?(qualified_name) klass elsif (base_class = ::Brick.config.sti_namespace_prefixes&.fetch("::#{const_name}", nil)&.constantize) # Build subclass and place it into Object Object.const_set(const_name.to_sym, klass = Class.new(base_class)) else _brick_autoload_module!(*args) end end |