Class: Jambots::Controllers::ChatController
- Inherits:
-
Object
- Object
- Jambots::Controllers::ChatController
- Defined in:
- lib/jambots/controllers/chat_controller.rb
Constant Summary collapse
- DEFAULT_BOT =
"jambot"
- DEFAULT_TIMEOUT =
240
Instance Attribute Summary collapse
-
#bot ⇒ Object
readonly
Returns the value of attribute bot.
-
#conversation ⇒ Object
readonly
Returns the value of attribute conversation.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
Instance Method Summary collapse
- #chat(query) ⇒ Object
-
#initialize(options) ⇒ ChatController
constructor
A new instance of ChatController.
Constructor Details
#initialize(options) ⇒ ChatController
Returns a new instance of ChatController.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jambots/controllers/chat_controller.rb', line 10 def initialize() bot_name = bot_name() = () @bot = Jambots::Bot.new(bot_name, ) = () @conversation = load_conversation() @renderer = load_renderer() end |
Instance Attribute Details
#bot ⇒ Object (readonly)
Returns the value of attribute bot.
8 9 10 |
# File 'lib/jambots/controllers/chat_controller.rb', line 8 def bot @bot end |
#conversation ⇒ Object (readonly)
Returns the value of attribute conversation.
8 9 10 |
# File 'lib/jambots/controllers/chat_controller.rb', line 8 def conversation @conversation end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
8 9 10 |
# File 'lib/jambots/controllers/chat_controller.rb', line 8 def renderer @renderer end |
Instance Method Details
#chat(query) ⇒ Object
21 22 23 24 25 |
# File 'lib/jambots/controllers/chat_controller.rb', line 21 def chat(query) renderer.render(conversation) do bot.(query, conversation) end end |