Kaceka2016/dictionary.rb

15 lines
296 B
Ruby

txt = open("input.txt")
filenames = ["actions.txt", "directions.txt", "movement.txt"]
dictionary = {}
txt.each_line do |line|
filenames.each do |name|
if File.read(name).include?line
dictionary[name.chomp('.txt')] = line.chomp("\n")
end
end
end
puts dictionary