X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FRuby%2FMonitor.git;a=blobdiff_plain;f=ini_read.rb;h=41259d88117b3e0879b2beec79ffaeeb025b0efe;hp=9ae3f1ba2a70a47bbd5bb291b272e6781325b42d;hb=HEAD;hpb=332497b1a92f4257eea0c9257d041c8898c91c31 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 find_ini(options.inifile) read_ini() parse_config() + parse_global() end def find_ini(option_inifile) @@ -47,7 +48,7 @@ class Ini_read end def read_ini() - @config = IniFile.load(@inifile, :default=>'global') + @config = IniFile.load(@inifile, :default => 'global') if(@config.nil?) puts "Initialization file not found or not readable" exit @@ -65,6 +66,7 @@ class Ini_read sec = @config[section] if(section == "global") @global = sec + next end if(not sec.has_key?('Type')) puts "Section incomplete, ignored: "+ section @@ -87,5 +89,16 @@ class Ini_read end end + def parse_global() + if(@global.has_key?('list_size')) + @global['list_size'] = @global['list_size'].to_i + if(@global['list_size'] == 0) + @global['list_size'] = 25 + end + else + @global['list_size'] = 25 + end + end + end