class Daneel::Adapters::Shell

Public Class Methods

new(robot) click to toggle source
Calls superclass method
# File lib/daneel/adapters/shell.rb, line 8
def initialize(robot)
  super
  @room = Room.new("shell", self)
  @user = User.new(1, ENV['USER'])
end

Public Instance Methods

announce(*strings) click to toggle source
# File lib/daneel/adapters/shell.rb, line 29
def announce(*strings)
  puts
  say @room.id, *strings
end
run() click to toggle source
# File lib/daneel/adapters/shell.rb, line 14
def run
  # End the line we were on when we exit
  trap(:EXIT){ print "\n" }

  while text = Readline.readline("> ", true)
    next if text.empty?
    message = Message.new(text, Time.now, "text")
    robot.receive @room, message, @user
  end
end
say(id, *strings) click to toggle source
# File lib/daneel/adapters/shell.rb, line 25
def say(id, *strings)
  puts *strings
end