diff options
Diffstat (limited to 'ini_read.rb')
-rw-r--r-- | ini_read.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ini_read.rb b/ini_read.rb index 9ae3f1b..41259d8 100644 --- a/ini_read.rb +++ b/ini_read.rb | |||
@@ -32,6 +32,7 @@ class Ini_read | |||
32 | find_ini(options.inifile) | 32 | find_ini(options.inifile) |
33 | read_ini() | 33 | read_ini() |
34 | parse_config() | 34 | parse_config() |
35 | parse_global() | ||
35 | end | 36 | end |
36 | 37 | ||
37 | def find_ini(option_inifile) | 38 | def find_ini(option_inifile) |
@@ -47,7 +48,7 @@ class Ini_read | |||
47 | end | 48 | end |
48 | 49 | ||
49 | def read_ini() | 50 | def read_ini() |
50 | @config = IniFile.load(@inifile, :default=>'global') | 51 | @config = IniFile.load(@inifile, :default => 'global') |
51 | if(@config.nil?) | 52 | if(@config.nil?) |
52 | puts "Initialization file not found or not readable" | 53 | puts "Initialization file not found or not readable" |
53 | exit | 54 | exit |
@@ -65,6 +66,7 @@ class Ini_read | |||
65 | sec = @config[section] | 66 | sec = @config[section] |
66 | if(section == "global") | 67 | if(section == "global") |
67 | @global = sec | 68 | @global = sec |
69 | next | ||
68 | end | 70 | end |
69 | if(not sec.has_key?('Type')) | 71 | if(not sec.has_key?('Type')) |
70 | puts "Section incomplete, ignored: "+ section | 72 | puts "Section incomplete, ignored: "+ section |
@@ -87,5 +89,16 @@ class Ini_read | |||
87 | end | 89 | end |
88 | end | 90 | end |
89 | 91 | ||
92 | def parse_global() | ||
93 | if(@global.has_key?('list_size')) | ||
94 | @global['list_size'] = @global['list_size'].to_i | ||
95 | if(@global['list_size'] == 0) | ||
96 | @global['list_size'] = 25 | ||
97 | end | ||
98 | else | ||
99 | @global['list_size'] = 25 | ||
100 | end | ||
101 | end | ||
102 | |||
90 | end | 103 | end |
91 | 104 | ||