Skip to content

Instantly share code, notes, and snippets.

@Pysis868
Forked from adhown/bot_data_to_yaml.rb
Last active April 29, 2016 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pysis868/95e5b7442c27c3c9fd77731b3bed9ec8 to your computer and use it in GitHub Desktop.
Save Pysis868/95e5b7442c27c3c9fd77731b3bed9ec8 to your computer and use it in GitHub Desktop.
Learning ruby basic
require 'yaml'
bot_data = {
:presubs => [
["dont", "dont"],
["youre", "you're"],
["love", "like"]
],
:responses => {
:default => [
"I don't understand.",
"what?",
"Huhhh bete?"
],
:greeting => ["Hi. I'm [name]. Want to chat?"],
:farewell => ["Good bye!"],
'hello' => [
"How's it going?",
"How do you do?"
],
'i like *' => [
"Why do you like *?",
"Wow I like * too!"
]
}
}
#Menampilkan struktur user dengan yaml
#
puts bot_data.to_yaml
#Write the yaml data to file
f = File.open(ARGV.first || 'bot_data', "w")
f.puts bot_data.to_yaml
f.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment