Tuesday, May 29, 2012

Global variable in Ruby/JRuby

If anybody wants to create a global variable which can be access to all the ruby class and module through out the project. then follow the example given below:

$globalvariable=

class
   .
   .
   .

end


The value of the globalvariale can be access through out the ruby project.

i.e. puts($globalvariable)

NOTE: "$globalvariable=value" may be display as $globalvariable= . it is a Bug with Blogger. So read it as  "$globalvariable=value"

No comments:

Post a Comment