Afficher un message
Vieux 13/03/2008, 11h52   #8
Mario Ruiz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: including general variables in modules

Actually what I want is to include an scenario with all my global
variables and if I want another scenario I can include it and all the
global variables will change.
module Scenarios
module MyFirstSc
$web="http://www.elmundo.es"
$sqlSearch="select video from datab"
$user="Pep"
$password="xxx"
end
module MySecondSc
$web="http://www.elmundo.es"
$sqlSearch="select audiodefault from datab"
$user="Bee"
$password="2x8"
end
end

In my test cases I'll have in the first line for example:
include Scenarios::MySecondSc
and if I want to change the scenario I only have to change this line:
include Scenarios::MyFirstSc

How can I do it without including an extraline with a method?
I know I could do something like:
module Scenarios
module MyFirstSc
def getValues
$web="http://www.elmundo.es"
$sqlSearch="select video from datab"
$user="Pep"
$password="xxx"
end
end
...
end

and in the first line we'll write:
include Scenarios::MyFirstSc
Scenarios::MyFirstSc.getValues()


But I don't like this way I would like to do it in only one line... is
it possible???

Thanks for your time.
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
 
Page generated in 0,07135 seconds with 9 queries