Sha256: 60960a2c13f8386beac6ce76386e253a8f791c917eefdf100a8dc55089a3faf0
Contents?: true
Size: 866 Bytes
Versions: 3
Compression:
Stored size: 866 Bytes
Contents
require "readline" module Ellen module Adapters class Shell < Base PROMPT = "> " SOURCE = "shell" USAGE = "Type `exit` or `quit` to end the session." attr_accessor :stopped def run explain listen end def say(body, options = {}) Ellen.logger.info(body) end private def explain Ellen.logger.info(USAGE) end def read Readline.readline(PROMPT, true) end def listen step until stopped? rescue Interrupt stop end def step case body = read when "exit", "quit" stop else robot.receive(body: body, source: SOURCE) end end def stopped? !!stopped end def stop self.stopped = true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ellen-0.1.3 | lib/ellen/adapters/shell.rb |
ellen-0.1.2 | lib/ellen/adapters/shell.rb |
ellen-0.1.1 | lib/ellen/adapters/shell.rb |