10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/oxidized/hook/exec.rb', line 10
def validate_cfg!
if cfg.has_key? "timeout"
@timeout = cfg.timeout
raise "invalid timeout value" unless @timeout.is_a?(Integer) &&
@timeout > 0
end
if cfg.has_key? "async"
@async = !!cfg.async
end
if cfg.has_key? "cmd"
@cmd = cfg.cmd
raise "invalid cmd value" unless @cmd.is_a?(String) || @cmd.is_a?(Array)
end
rescue RuntimeError => e
raise ArgumentError,
"#{self.class.name}: configuration invalid: #{e.message}"
end
|