Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dinjas/d3c266a333d834df5c3d to your computer and use it in GitHub Desktop.
Save dinjas/d3c266a333d834df5c3d to your computer and use it in GitHub Desktop.
Ruby recursively require all files in directory
# recursively require all files in directory (and subdirectories)
Dir["#{File.dirname(__FILE__)}/squat/**/*.rb"].each do |file|
require file
end
# recursively require all files in directory but skip paths that
# match a pattern
Dir["#{File.dirname(__FILE__)}/squat/**/*.rb"].each do |file|
require file unless file =~ /\/model\//
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment