Yes, you can do that.. i think use the following
scripts to take the values from the files...

require 'singleton'

class Configuration
            include Singleton
            @Include_paths=[]
            @@config_file_name="global-config.cfg" 
 
       def initialize()
                @Include_paths=[]
                @props = Property.new()
                @@config_dir = "."
                @config_file=@@config_dir +
@@config_file_name
        if File.exists?(@config_file) 
                   
@props.load(File.open(@config_file))  
                   
@[EMAIL PROTECTED]'Common.global1']
                end                            
       end
    def global_config1()
          return @gobalconfig1
    end 
end

====================global-config.cfg should look like
this ================

[Common]
global1 = i dont know which is the global config file


Make changes to the script accordingly and then you
can call this in your script by using the following
scripts.

cp = Configuration.instance()
puts cp.global_config1()


the result for this would be "i dont know which is the
global config file"

Let me know find any issues.

Sathya Shankar
Qantom Software


--- "Torres, Ben (HQP)" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Can I keep all my global variables in a separate
> file from my script
> files and have several script files use these
> variables?  If so, how?
> 
> Thanks in advance,
> Ben
> 
> 
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
> 



        
                
__________________________________ 
Yahoo! for Good - Make a difference this year. 
http://brand.yahoo.com/cybergivingweek2005/
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to