Created
March 23, 2017 18:16
-
-
Save kenjij/14a5f001de7cdf43913f157ff7f0204b to your computer and use it in GitHub Desktop.
Load files from list of directories in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_from_path(path) | |
Dir.chdir(path) { | |
Dir.foreach('.') { |f| load f unless File.directory?(f) } | |
} | |
end | |
paths = [ | |
'conf.d', | |
'plugins' | |
] | |
paths.each { |path| | |
load_from_path(path) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment