14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/train/options.rb', line 14
def option(name, conf = nil, &block)
d = conf || {}
unless d.is_a? Hash
fail Train::ClientError,
"The transport plugin #{self} declared an option #{name} "\
"and didn't provide a valid configuration hash."
end
if !conf.nil? and !conf[:default].nil? and block_given?
fail Train::ClientError,
"The transport plugin #{self} declared an option #{name} "\
'with both a default value and block. Only use one of these.'
end
d[:default] = block if block_given?
default_options[name] = d
end
|