10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/load_dialogs.rb', line 10
def self.run_dialogs botname, dialogs_path
@@botname = botname
dialog_paths = Dir.glob(dialogs_path).sort.select{ |e| File.file? e }
dialog_yamls = dialog_paths.collect{ |dialog_file| Hashie.symbolize_keys YAML.load_file(dialog_file).merge!(file: dialog_file) }
dialog_yamls.collect{ |dialog_content|
dialog_content[:dialogs].collect{ |dialog|
Dialog.new({describe: dialog_content[:description], name: dialog[:what], interactions: dialog[:dialog], file: dialog_content[:file]})
}
}.flatten
end
|