class Socrates::Bots::CLI

Public Class Methods

new(state_factory:, adapter: nil) click to toggle source
# 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

Public Instance Methods

start() click to toggle source
# File lib/socrates/bots/cli.rb, line 12
def start
  context = { channel: "CONSOLE" }

  while (input = gets.chomp)
    @dispatcher.dispatch(input, context: context)
  end
end