class SpicedRumby::CLIOutput
Public Instance Methods
add_line(line)
click to toggle source
TODO: find a more elegant way to handle color
# File lib/spiced_rumby/cli_output.rb, line 14 def add_line(line) puts line end
alert(msg)
click to toggle source
# File lib/spiced_rumby/cli_output.rb, line 26 def alert(msg) puts msg.colorize(:red) end
chat(msg)
click to toggle source
# File lib/spiced_rumby/cli_output.rb, line 34 def chat(msg) words = msg.split(' ') time = words[0..1] name = words[2] message = words[3..words.length] print (time.join(' ') + ' ').colorize(:light_magenta) print (name + ' ').colorize(:cyan) print message.join(' ') + "\n" end
info(msg)
click to toggle source
# File lib/spiced_rumby/cli_output.rb, line 18 def info(msg) puts msg.colorize(:light_black) end
start() { || ... }
click to toggle source
# File lib/spiced_rumby/cli_output.rb, line 3 def start puts "\n" alert 'Welcome to Spiced Rumby!' puts "\n" puts "\n" yield if block_given? MeshChat::CLI.listen_for_commands end
success(msg)
click to toggle source
# File lib/spiced_rumby/cli_output.rb, line 30 def success(msg) puts msg.colorize(:green) end
warning(msg)
click to toggle source
# File lib/spiced_rumby/cli_output.rb, line 22 def warning(msg) puts msg.colorize(:yellow) end
whisper(msg)
click to toggle source
# File lib/spiced_rumby/cli_output.rb, line 45 def whisper(msg) words = msg.split(' ') time = words[0..1] name = words[2] message = words[3..words.length] print (time.join(' ') + ' ').colorize(:magenta) print (name + ' ').colorize(:light_black) print message.join(' ') + "\n" end