lib/lita/adapters/shell.rb in lita-2.2.0 vs lib/lita/adapters/shell.rb in lita-2.2.1
- old
+ new
@@ -12,13 +12,11 @@
loop do
print "#{robot.name} > "
input = $stdin.gets.chomp.strip
break if input == "exit" || input == "quit"
- message = Message.new(robot, input, source)
- message.command! if Lita.config.adapter.private_chat
- robot.receive(message)
+ robot.receive(build_message(robot, input, source))
end
end
# Outputs outgoing messages to the shell.
# @param target [Lita::Source] Unused, since there is only one user in the
@@ -31,9 +29,17 @@
# Adds a blank line for a nice looking exit.
# @return [void]
def shut_down
puts
+ end
+
+ private
+
+ def build_message(robot, input, source)
+ message = Message.new(robot, input, source)
+ message.command! if Lita.config.adapter.private_chat
+ message
end
end
Lita.register_adapter(:shell, Shell)
end