Class: Socrates::Bots::CLIBot
- Inherits:
-
Object
- Object
- Socrates::Bots::CLIBot
- Defined in:
- lib/socrates/bots/cli_bot.rb
Instance Method Summary collapse
-
#initialize(state_factory:) ⇒ CLIBot
constructor
A new instance of CLIBot.
- #start ⇒ Object
Constructor Details
#initialize(state_factory:) ⇒ CLIBot
Returns a new instance of CLIBot.
4 5 6 7 |
# File 'lib/socrates/bots/cli_bot.rb', line 4 def initialize(state_factory:) @adapter = ConsoleAdapter.new @dispatcher = Core::Dispatcher.new(adapter: @adapter, state_factory: state_factory) end |
Instance Method Details
#start ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/socrates/bots/cli_bot.rb', line 9 def start # Clear out any remnants from previous runs. @storage.clear(ConsoleAdapter::CLIENT_ID) while (input = gets.chomp) @dispatcher.dispatch(message: input) end end |