class BitmapCmdEditor::Client

@author Diego HernĂ¡n Piccinini Lagos This class handle the the interactive loop until X + Enter to exit

Public Class Methods

get_commands() click to toggle source

getting commands in a loop

# 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