Sha256: 76a83d76c65c513db0bc3a9ca973f9d56afe317cce406ba2d179a0b91c20f901

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 Bytes

Contents

module Socrates
  module Bots
    class CLIBot
      def initialize(state_factory:)
        @adapter    = ConsoleAdapter.new
        @storage    = Storage::MemoryStorage.new
        @dispatcher = Core::Dispatcher.new(storage: @storage, adapter: @adapter, state_factory: state_factory)
      end

      def start
        # Clear out any remnants from previous runs.
        @storage.clear(ConsoleAdapter::CLIENT_ID)

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
socrates-0.1.0 lib/socrates/bots/cli_bot.rb