Sha256: 6b9a1903b5909c74def733afa2cedde3a2467889547ddf09f23cda60ac3304b1

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

require "socrates/adapters/console"
require "socrates/core/dispatcher"

module Socrates
  module Bots
    class CLI
      def initialize(state_factory:, adapter: nil)
        @adapter    = adapter || Adapters::Console.new
        @dispatcher = Core::Dispatcher.new(adapter: @adapter, state_factory: state_factory)
      end

      def start
        context = { channel: "CONSOLE" }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
socrates-0.1.26 lib/socrates/bots/cli.rb