Skip to content

Instantly share code, notes, and snippets.

@cherryramatisdev
Created August 27, 2023 11:40
Show Gist options
  • Select an option

  • Save cherryramatisdev/36675cc2e3795da22965978023f6dd23 to your computer and use it in GitHub Desktop.

Select an option

Save cherryramatisdev/36675cc2e3795da22965978023f6dd23 to your computer and use it in GitHub Desktop.
def reload!(print: true)
puts 'Reloading ...' if print
# Main project directory.
root_dir = Dir.pwd
# Directories within the project that should be reloaded.
reload_dirs = %w[lib app]
# Loop through and reload every file in all relevant project directories.
reload_dirs.each do |dir|
Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
end
# Return true when complete.
true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment