Class: BitmapCmdEditor::Validators::CommandValidator

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

Overview

To validate the command and show the user a help message

Author:

  • Diego HernĂ¡n Piccinini Lagos

Class Method Summary collapse

Class Method Details

.validate(input) ⇒ Object

Parameters:

  • input (String)

    the input command string



8
9
10
11
12
13
14
15
16
# File 'lib/bitmap_cmd_editor/validators/command_validator.rb', line 8

def validate(input)
	begin
		args=input.split(' ')
		raise NotImplementedCommand.new(ErrorMessage.new(:command_not_exist).show_content) unless BitmapCmdEditor::COMMANDS.include?(args[0])
		:valid
	rescue NotImplementedCommand => err
		err.message
	end
end