How can I scan a directory, get the ruby files, execute them and get the output? -


i have no experience in ruby, got task. specification says got argument command line directory path. have scan dir ruby files. if found them, have execute , write file results.

if have given path input_dir can change directory path, ruby files , iterate executing them:

input_dir = "/path"  dir.chdir(input_dir) search_string = input_dir + "/*.rb" ruby_files = dir[search_string] ruby_files.each |file|   system("ruby", file) end 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -