Kaceka2016/dictionary.rb

15 lines
299 B
Ruby

txt = open("keywords.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