From: Jarmo Pertman Date: 2010-07-28T02:15:04+09:00 Subject: Re: syntax And also, is you want to have access to @config and @database from the outside, then as already mentioned then all instance variables (the ones with @) are private. That means you have to use methods to set and get the values of those variables. So you could create a methods like this: class Web def config @config end def config=(new_config) @config = new_config end ... end But, since most of the time the get and set methods are defined just like the ones above then you can create those methods semi- automatically by an accessor methods. So, to define an get and set methods for @config and @database, you can do it like this: class Web attr_accessor :config, :database end Or if you want just a get methods use "attr_reader" instead. And for a write-only access "attr_writer". Enjoy Ruby! ----- Jarmo Pertman IT does really matter - http://www.itreallymatters.net On Jul 26, 9:37 am, Jesús Gabriel y Galán wrote: > On Mon, Jul 26, 2010 at 7:06 AM, Raghu Maddali wrote: > >> from outside the object, you must use a method. > > > Hey Josh, > > > My declaration will be something like > > > Class Web > > class Web > > >     Private $conf > >     Private $database > > You don't need to declare the instance variables. And in any case > Private is not a Ruby keyword. And $var is a global variable. Just > remove all the $. > > >     def __construct() > > If you want this to be your class' constructor, the method is called > initialize, so > > def initialize > > > > >      @config = parse_ini_file('web/display.ini', true) > >      @database = @config['Catalog']['database'] > >     end > > end > > This would be fine. > > > > > Will this be a correct Ruby syntax > > Summary: > > class Web >   def initialize >     @config = parse_ini_file('web/display.ini', true) >     @database = @config['Catalog']['database'] >   end > end > > Jesus.