Class: Lore::Validation::Reason

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

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, options) ⇒ Reason

{{{



17
18
19
20
# File 'lib/lore/validation/reason.rb', line 17

def initialize(message, options) # {{{
  @message = message
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



11
12
13
# File 'lib/lore/validation/reason.rb', line 11

def options
  @options
end

Class Method Details

.of_exception(excep) ⇒ Object

System exception:



41
42
43
44
45
46
47
# File 'lib/lore/validation/reason.rb', line 41

def self.of_exception(excep) # {{{

  options = [:choice_critical, :choice_recommended] 
  message = excep.message + ': ' + excep.backtrace.join('<br />')
  return self.new(message, options)
  
end

.of_invalid_parameters(ikp) ⇒ Object

Parameter validation failed:



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

def self.of_invalid_parameters(ikp) # {{{

  message = Lore::Validation::Error_Message.compose_error_message(ikp.serialize())
  @logger.debug('Reason message: '+message.inspect)
  return self.new(message, @options)
  
end

.of_user_runtime_error(excep) ⇒ Object

System exception:



32
33
34
35
36
37
38
# File 'lib/lore/validation/reason.rb', line 32

def self.of_user_runtime_error(excep) # {{{

  options = [:choice_critical, :choice_recommended] 
  message = Lang[excep.message]
  return self.new(message, options)
  
end

Instance Method Details

#messageObject



13
14
15
# File 'lib/lore/validation/reason.rb', line 13

def message()
  @message
end