Module: ActiveEvent::Support::Autoloader
- Defined in:
- lib/active_event/support/autoloader.rb
Class Method Summary collapse
Class Method Details
.load_from(dirs) ⇒ Object
4 5 6 7 8 |
# File 'lib/active_event/support/autoloader.rb', line 4 def self.load_from(dirs) Dir[*dirs].each do |file| require file end end |
.reload(name, path) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_event/support/autoloader.rb', line 16 def self.reload(name, path) const_name, namespace_name = name.to_s.split('::').reverse if namespace_name.nil? Object.send(:remove_const, const_name) if Object.const_defined?(const_name) else namespace = const_get(namespace_name) namespace.send(:remove_const, const_name) if namespace.const_defined?(const_name) end $LOADED_FEATURES.delete_if { |s| s.include?(path) } require path end |
.reload_from(dirs) ⇒ Object
10 11 12 13 14 |
# File 'lib/active_event/support/autoloader.rb', line 10 def self.reload_from(dirs) Dir[*dirs].each do |path| reload get_module_name(path), path end end |