class MindControl::CUI
Console User Interface.
Attributes
highline[R]
Public Class Methods
new( stdin = STDIN, stdout = STDOUT )
click to toggle source
@param [IO] stdin (STDIN) Console input. @param [IO] stdout (STDOUT) Console output.
# File lib/mind_control/cui.rb, line 15 def initialize( stdin = STDIN, stdout = STDOUT ) @highline = ::HighLine.new( stdin, stdout ) end
Public Instance Methods
select_process( process_list )
click to toggle source
Ask user to select process from list.
@param [Array<MindControl::Client::Process>] process_list @return [MindControl::Client::Process]
# File lib/mind_control/cui.rb, line 25 def select_process( process_list ) highline.choose do |menu| menu.header = "Select process" menu.select_by = :index process_list.each do |process| menu.choice( "#{process.name} (PID: #{process.pid})" ) { process } end end end
show_debug( message )
click to toggle source
Show debug message. @param [String] message
# File lib/mind_control/cui.rb, line 40 def show_debug( message ) highline.say HighLine::String.new( message ).white end
show_error( message )
click to toggle source
Show error message. @param [String] message
# File lib/mind_control/cui.rb, line 48 def show_error( message ) highline.say HighLine::String.new( message ).red end