Bauduin Raphael a ñÄrit :

> Hi,
> 
> I thought to create a module to add an instance variable representing 
> the connection to a database:
> 
> module MyDbModule
>       attr :conn
>       require "postgres"
>       pghost="localhost"
>       pgport=nil
>       pgoptions=nil
>       pgtty=nil
>       dbname="mydb"
>       user='mylogin'
>       password='mypassword'
>      
> @conn=PGconn.connect(pghost,pgport,pgoptions,pgtty,dbname,user,password)
> 
> end
To use a module variable through "MyModule.my_var", just prefix the 
variable name in the module with "self." or "@@".

Lio