Class: Lore::Validation::Error_Message

Inherits:
Message
  • Object
show all
Defined in:
lib/lore/validation/message.rb

Overview

class

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compose_error_message(serial_array) ⇒ Object

def }}}



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/lore/validation/message.rb', line 33

def self.compose_error_message(serial_array) # {{{
	
	message = []
	serial_array.uniq!
	serial_array.each { |serial_code|
	# klass--name--given--typecode (from Invalid_Klass_Parameters) 
	# to [klass,name,given,typecode]
#				@logger.log('serial code: '+serial_code.to_s)
		invalid_parameter = serial_code.split('--')

		# try to resolve a human readable name for this parameter: 
		if !Lang[invalid_parameter[1]].nil? then inv_param_name = Lang[invalid_parameter[1]] 
		else inv_param_name = invalid_parameter[1] end
		
		if invalid_parameter[2] == '' then 
			message << Lang[:error__specify_value].gsub('{1}', inv_param_name)
		else
			message << Lang[:error__invalid_value].gsub('{1}', inv_param_name)
		end
	}
	return message
	
end

Instance Method Details

#[](serial_string) ⇒ Object

{{{



23
24
25
26
27
28
29
30
31
# File 'lib/lore/validation/message.rb', line 23

def [](serial_string) # {{{

	if $cb__message_strings[$lang].include?(serial_string) then
		compose_error_message(serial_string)
	else 
		return $cb__error_strings[$lang][serial_string]
	end	
	
end