Class: TTK::Status
- Inherits:
-
Object
show all
- Includes:
- Abstract
- Defined in:
- lib/ttk/status.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Status
Returns a new instance of Status.
39
40
41
|
# File 'lib/ttk/status.rb', line 39
def initialize
@weight = self.class.default_weight_value
end
|
Instance Attribute Details
Returns the value of attribute weight.
24
25
26
|
# File 'lib/ttk/status.rb', line 24
def weight
@weight
end
|
Class Method Details
.default_weight_value ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ttk/status.rb', line 26
def self.default_weight_value
val = nil
if const_defined? :DEFAULT_WEIGHT
if const_defined? :DEFAULT_WEIGHT_VALUE
val = const_get(:DEFAULT_WEIGHT_VALUE)
else
val = Weights::Default.new(const_get(:DEFAULT_WEIGHT))
const_set(:DEFAULT_WEIGHT_VALUE, val)
end
end
val
end
|
.hook_name ⇒ Object
47
48
49
|
# File 'lib/ttk/status.rb', line 47
def self.hook_name
(status_name.to_s.downcase + '_hook').to_sym
end
|
.status_name ⇒ Object
43
44
45
|
# File 'lib/ttk/status.rb', line 43
def self.status_name
name.sub(/^.*?(\w+)Status$/, '\1').upcase.to_sym
end
|
Instance Method Details
#hook_name ⇒ Object
51
52
53
|
# File 'lib/ttk/status.rb', line 51
def hook_name
self.class.hook_name
end
|
#pass? ⇒ Boolean
67
68
69
|
# File 'lib/ttk/status.rb', line 67
def pass?
false
end
|
55
56
57
58
59
60
61
|
# File 'lib/ttk/status.rb', line 55
def to_s
res = self.class.status_name.to_s
if @weight != self.class.default_weight_value
res += "(#{@weight.get})"
end
res
end
|
#to_ttk_log(log) ⇒ Object
63
64
65
|
# File 'lib/ttk/status.rb', line 63
def to_ttk_log ( log )
log.status = self.to_s
end
|