15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/coded_options/base.rb', line 15
def coded_options *args
case args.length
when 1 then
hash = args.first
if (new_initial_value = hash.delete(:initial_value))
old_initial_value = CodedOptions.initial_value
CodedOptions.initial_value = new_initial_value
hash.each {|name, values| setup_coded_options name, values }
CodedOptions.initial_value = old_initial_value
else
hash.each {|name, values| setup_coded_options name, values }
end
when 2 then setup_coded_options *args
else raise("Error in coded_options syntax, expecting name and values or a hash, got #{args.inspect}")
end
end
|