Class: Socrates::Bots::CLI
- Inherits:
-
Object
- Object
- Socrates::Bots::CLI
- Defined in:
- lib/socrates/bots/cli.rb
Instance Method Summary collapse
-
#initialize(state_factory:, adapter: nil) ⇒ CLI
constructor
A new instance of CLI.
- #start ⇒ Object
Constructor Details
#initialize(state_factory:, adapter: nil) ⇒ CLI
Returns a new instance of CLI.
7 8 9 10 |
# File 'lib/socrates/bots/cli.rb', line 7 def initialize(state_factory:, adapter: nil) @adapter = adapter || Adapters::Console.new @dispatcher = Core::Dispatcher.new(adapter: @adapter, state_factory: state_factory) end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/socrates/bots/cli.rb', line 12 def start context = { channel: "CONSOLE" } while (input = gets.chomp) @dispatcher.dispatch(input, context: context) end end |