10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/ios-box/tools/config.rb', line 10
def set(key, value)
if ["true", "yes"].include?(value.downcase)
value = true
elsif ["false", "no"].include?(value.downcase)
value = false
end
config = IOSBox.new.config
category, key = key.split(/\./)
if key.nil?
config.send("#{category}=", value)
else
if !config.send(category).kind_of?(Hash)
config.send("#{category}=", {})
end
config.send(category).send(:[]=, key, value)
end
config.save
end
|