Configuration usage sample

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require "Configuration/ConfigurationBase"
#Configuration class
#Example usage:
# require "Configuration"
# puts Configuration[:debug]
#So simple easy!
class Configuration < ConfigurationBase
#Active preferences collection
#You should use this to separate various type of settings
#For example, you can define 'development' and 'production' settings
#If active preference is not defined, first entry in preferences will be treated as active
active :development
#Each preference is defined by preference keyword
#Class can contain various number of preferences
preference :development =>
{
:debug => true,
:store =>
{
:host => "localhost",
:username => "root",
:password => "root",
:database => "gbase"
}
}
#Deployment section
preference :deployment =>
{
:debug => false,
:store =>
{
:host => "localhost",
:username => "deploybase",
:password => "somestrongpassword",
:datatabse => "gbase"
}
}
end