Module: Module::Reloader
- Defined in:
- lib/module_ext.rb
Class Method Summary collapse
Class Method Details
.reload(*mods) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/module_ext.rb', line 23 def self.reload(*mods) source_files = mods.map(&:source_files).flatten.uniq # Skip files that live in .gem and .rvm directories. source_files.reject! do |source_file| source_file =~ /\/\.gem\// || source_file =~ /\/\.rvm\// end source_files.each do |source_file| reload_file(source_file) end end |
.reload_file(file) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/module_ext.rb', line 37 def self.reload_file(file) r = load(file) STDERR.puts("load #{file.inspect}: #{r ? "OK" : r.inspect}") !!r rescue LoadError STDERR.puts "load #{file.inspect}: raised #{$!}" false end |