Class: BitmapCmdEditor::Validators::ErrorMessage
- Inherits:
-
Object
- Object
- BitmapCmdEditor::Validators::ErrorMessage
- Defined in:
- lib/bitmap_cmd_editor/validators/error_message.rb
Overview
An intance contains te error_type and a message to the user
Constant Summary collapse
- MESSAGES =
{ :invalid => "This operation is invalid", :command_not_exist => "This command is not available, please check the available commands", :more_than_max => "the maximun %{obj} allowed are %{max} and you want %{quantity}", :less_than_min => "the minimun %{obj} allowed is %{min} and you want %{quantity}", :command_wrong_arguments => "this command require %{arguments} arguments", :clear_image_wrongs_arguments => "clear image hasn't arguments", :print_table_arguments => "print table hasn't arguments", :colours_pixel_out_of_range => "a valid %{obj} values are between %{min} and %{max}, and you try %{quantity}", :coordinates_are_not_integer => "the coordinates M N must be integers", :out_of_range => "a valid %{obj} values are between %{min} and %{max}, and you try %{quantity}", :the_colour_is_invalid => "the colour must be a Capital Letter A-Z" }
Instance Method Summary collapse
-
#initialize(error_type = :invalid, args = {}, content = nil) ⇒ ErrorMessage
constructor
initialize the message.
-
#show_content ⇒ Object
Text message [String] it could contain arguments.
Constructor Details
#initialize(error_type = :invalid, args = {}, content = nil) ⇒ ErrorMessage
initialize the message
23 24 25 26 27 28 29 30 31 |
# File 'lib/bitmap_cmd_editor/validators/error_message.rb', line 23 def initialize(error_type = :invalid, args = {}, content = nil) unless content @content=MESSAGES[error_type] else @content = content end @error_type = error_type @args = args end |
Instance Method Details
#show_content ⇒ Object
Returns text message [String] it could contain arguments.
33 34 35 |
# File 'lib/bitmap_cmd_editor/validators/error_message.rb', line 33 def show_content "\n" + @content % @args end |