From: "Skye Shaw!@#$" Date: 2007-07-25T13:30:05+09:00 Subject: Re: Regarding Constants On Jul 24, 1:21 pm, Harnish Botadra wrote: > Hi, > > I am having some difficulty in the use of constants in Ruby. I've a > module: > > eg. > ------------------- > Module Constants Use lowercase "m" > I include this module in my model. Further, the name of the constant > (MY_CONST) would be passed in a variable say 'var'. My question, is how > do I access the value of the constant from the constant name in 'var'? module Constants GRR="burr!" end class Bs include Constants def self.get_constant(name) self.const_get(name.to_sym) end end p Bs.get_constant("GRR") Why do you need to access constants this way?