37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/snarl/snp/config.rb', line 37
def normalize
v = @value
case @key.to_s
when 'host' then
['host', if is_yaml_undef?(v) then nil else v end]
when 'port' then
['port', if is_yaml_undef?(v) then nil else v.to_i end]
when 'app', 'application', 'name', 'register' then
['app', if is_yaml_undef?(v) then nil else v end]
when 'class', 'add_class', 'classes' then
['class', (v)]
when 'title' then
['title', if is_yaml_undef?(v) then nil else v end]
when 'text', 'body', 'msg' then
['text', if is_yaml_undef?(v) then nil else v end]
when 'timeout', 'duration', 'sec' then
['timeout', if is_yaml_undef?(v) then 0 else v.to_i end] when 'sticky' then
['timeout', if is_yaml_false?(v) then nil else 0 end]
when 'icon' then ['icon', if is_yaml_undef?(v) then nil else v end]
when 'notification', 'notify', 'message' then
['notification', if is_yaml_undef?(v) then nil else v end]
when 'unregister' then
['unregister', if is_yaml_false?(v) then false else true end]
when 'iconset' then
['iconset', if is_yaml_undef?(v) then nil else v end]
when 'log', 'logger' then ['logger', v]
when 'logfile' then
['logfile', (v)]
when 'loglevel', 'logger.level', 'log_level' then
['loglevel', (v)]
when 'config' then
['config', if is_yaml_undef?(v) then nil else v end]
when 'yaml' then
['yaml', if is_yaml_undef?(v) then nil else v end]
else [@key.to_s, v] end
end
|