Class: BitmapCmdEditor::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmap_cmd_editor/client.rb

Overview

This class handle the the interactive loop until X + Enter to exit

Class Method Summary collapse

Class Method Details

.get_commandsObject

getting commands in a loop



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bitmap_cmd_editor/client.rb', line 10

def get_commands
	begin
		puts WELCOME_MESSAGE
		bitmap = Bitmap.new
		loop do
			input = Readline.readline("> ")
			input.strip!

			# the command X must not be processed it's only to exit
			if input=='X'
				puts "\nEnd the Session..."
				break
			else
					process=bitmap.process_command(input)
					puts process unless process==:valid
			end
		end

	rescue => err
		puts err.message
	end
end