Class: JohnDoe::ChatBot
- Inherits:
-
Object
- Object
- JohnDoe::ChatBot
- Defined in:
- lib/john-doe.rb
Instance Method Summary collapse
- #get_response(s) ⇒ Object
-
#initialize(filename = File.dirname(__FILE__) + "/../default.yml", quotes_filename = "quotes") ⇒ ChatBot
constructor
A new instance of ChatBot.
Constructor Details
#initialize(filename = File.dirname(__FILE__) + "/../default.yml", quotes_filename = "quotes") ⇒ ChatBot
Returns a new instance of ChatBot.
8 9 10 11 12 13 14 15 16 |
# File 'lib/john-doe.rb', line 8 def initialize(filename = File.dirname(__FILE__) + "/../default.yml" , quotes_filename = "quotes") unless File.exists? quotes_filename f = File.new(quotes_filename,"w") f.close end @loader = JohnDoe::Aiml.new @loader.load(filename) @responser = JohnDoe::Responser.new(@loader,quotes_filename) end |
Instance Method Details
#get_response(s) ⇒ Object
17 18 19 |
# File 'lib/john-doe.rb', line 17 def get_response(s) @responser.response s end |