From: Ryan Lewis Date: 2008-01-28T14:35:48+09:00 Subject: Re: Module Global Hash Wyatt Greene wrote: > On Jan 28, 12:17 am, Wyatt Greene wrote: >> > self.password = pw >> > end >> >> > I've also tried putting both a @ and @@ infront of user_hash but irb >> > comes up with the same error. >> > -- >> > Posted viahttp://www.ruby-forum.com/. >> >> Remember that in Ruby, everything is an object and objects communicate >> by passing messages (calling methods). So you can't get to variables >> of an object (such as user_hash). You can only call methods that an >> object responds to. > > I think what's going on here is that when the parser gets to the line > that says > > user_hash = {} > > it looks for a method called user_hash to execute. It doesn't realize > that you're trying to instantiate a variable. Maybe you should > consider turning the Users module into a class and trying @@user_hash > = {} again. I thought of this, but I'm going to be using a system with many many users and each time I would call Users, I would crate two classes, taking up twice as much memory. Should I just drop the module and just keep it in a Users.rb file to call it later? -- Posted via http://www.ruby-forum.com/.