]> git.immae.eu Git - perso/Immae/Projets/Ruby/Monitor.git/blobdiff - ini_read.rb
Customization of window size
[perso/Immae/Projets/Ruby/Monitor.git] / ini_read.rb
index 9ae3f1ba2a70a47bbd5bb291b272e6781325b42d..41259d88117b3e0879b2beec79ffaeeb025b0efe 100644 (file)
@@ -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