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
Post a Comment