Module: Simple::Workflow::Reloader
Overview
The Simple::Workflow::Reloader provides a way to locate and reload a module
Instance Method Summary collapse
-
#locate(a_module) ⇒ Object
This method tries to identify source files for a module’s functions.
- #reload(a_module) ⇒ Object
Instance Method Details
#locate(a_module) ⇒ Object
This method tries to identify source files for a module’s functions.
20 21 22 23 24 25 |
# File 'lib/simple/workflow/reloader.rb', line 20 def locate(a_module) expect! a_module => Module @registered_source_paths ||= {} @registered_source_paths[a_module.name] ||= locate_source_paths(a_module) end |
#reload(a_module) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/simple/workflow/reloader.rb', line 5 def reload(a_module) source_paths = locate(a_module) if source_paths.empty? logger&.warn "#{a_module}: cannot reload module: cannot find sources" return end source_paths.each do |source_path| logger&.debug "#{a_module}: reload #{source_path}" end logger&.info "#{a_module}: reloaded module" end |