Exception: Uttk::Status

Inherits:
UttkException show all
Includes:
Abstract
Defined in:
lib/uttk/status.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(anObject = nil) ⇒ Status

Returns a new instance of Status.



32
33
34
35
36
# File 'lib/uttk/status.rb', line 32

def initialize ( anObject=nil )
  super()
  @reason = anObject || default_reason
  @weight = default_weight_value
end

Instance Attribute Details

#reasonObject

Returns the value of attribute reason.



25
26
27
# File 'lib/uttk/status.rb', line 25

def reason
  @reason
end

#weightObject

Returns the value of attribute weight.



25
26
27
# File 'lib/uttk/status.rb', line 25

def weight
  @weight
end

Class Method Details

.default_weight(aSymbol) ⇒ Object



12
13
14
# File 'lib/uttk/status.rb', line 12

def self.default_weight ( aSymbol )
  self.default_weight_value = Weights::Default.new(aSymbol)
end

.hook_nameObject



20
21
22
# File 'lib/uttk/status.rb', line 20

def self.hook_name
  (status_name.to_s.downcase + '_hook').to_sym
end

.status_nameObject



16
17
18
# File 'lib/uttk/status.rb', line 16

def self.status_name
  name.sub(/^.*?(\w+)Status$/, '\1').upcase.to_sym
end

Instance Method Details

#hook_nameObject



43
44
45
# File 'lib/uttk/status.rb', line 43

def hook_name
  self.class.hook_name
end

#pass?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/uttk/status.rb', line 55

def pass?
  false
end

#to_sObject



47
48
49
50
51
52
53
# File 'lib/uttk/status.rb', line 47

def to_s
  res = self.class.status_name.to_s
  if @weight != default_weight_value
    res += "(#{@weight.get})"
  end
  res
end

#to_uttk_log(log) ⇒ Object



38
39
40
41
# File 'lib/uttk/status.rb', line 38

def to_uttk_log ( log )
  log.status = self.to_s
  log.reason = @reason unless @reason.nil?
end