Class: CodeReloader
- Inherits:
-
Object
- Object
- CodeReloader
- Defined in:
- lib/pry-moves/code_reloader.rb
Instance Method Summary collapse
-
#initialize ⇒ CodeReloader
constructor
A new instance of CodeReloader.
- #reload ⇒ Object
Constructor Details
#initialize ⇒ CodeReloader
Returns a new instance of CodeReloader.
3 4 5 6 7 8 |
# File 'lib/pry-moves/code_reloader.rb', line 3 def initialize @timestamps = {} traverse_files do |path| @timestamps[path] = File.mtime(path) end end |
Instance Method Details
#reload ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pry-moves/code_reloader.rb', line 10 def reload traverse_files do |path| if @timestamps[path] != File.mtime(path) if reload_file path @timestamps[path] = File.mtime(path) # Log.info "⚡️ file reloaded #{path}" end end end end |