Class: BitmapCmdEditor::Validators::ValidatorHelper

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

Overview

To validate a new bitmap image table created

Class Method Summary collapse

Class Method Details

.less_than_min(obj, min, quantity) ⇒ Object



16
17
18
19
20
21
# File 'lib/bitmap_cmd_editor/validators/validator_herlper.rb', line 16

def less_than_min(obj,min,quantity)
	raise LessColumnsThanAllowed.new(ErrorMessage.new(
			:less_than_min,
			{:obj=> obj , :min => min,:quantity => quantity }
			).show_content) if quantity < min
end

.more_than_max(obj, max, quantity) ⇒ Object



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

def more_than_max(obj,max,quantity)
	raise MoreColumnsThanAllowed.new(ErrorMessage.new(
		:more_than_max,
		{:obj=> obj , :max => max,:quantity => quantity }
		).show_content) if quantity > max

end

.out_of_range(obj, min, max, quantity) ⇒ Object

Raises:



23
24
25
26
27
28
# File 'lib/bitmap_cmd_editor/validators/validator_herlper.rb', line 23

def out_of_range(obj,min,max,quantity)
	raise OutOfRange.new(ErrorMessage.new(
			:out_of_range,
			{:obj=> obj , :min => min,:max => max,:quantity => quantity }
			).show_content) if quantity<min or quantity>max
end