Hi,
for each user I need to create and call
a dynamically named GLOBAL variable (or Constant)
labeled with the user name.
To make it clear what I mean:
begin “Ruby Pseudocode”
user_name = “tom”
$#{user_name}_dyn_var = “/path/to/nirvana”
end “Ruby Pseudocode”
Is there a way to do that?
How would I call that new variable ‘$#{user_name}_dyn_var’ ?
I tried “Module::const_set”:
begin Ruby
constant_name = “#{user_name.upcase}_VAR”
constant = self::class::const_set(constant_name, “/path/to/nirvana”)
end Ruby
but couldn’t find a way to call “#{user_name.upcase}_VAR”.
you may ask why I either need a global var or a Constant:
I am using the “live_tree” plugin
from LiveTree | epiphyte.ca
to create a file system browser.
As far as I can tell,
the plugin requires either a global var or a Constant
to initialize the file system model.
If someone has tried this plugin before
and found another solution, let me know.
The author is not responding to my mails.
Thanks for your input,
Tom.