From: David Masover Date: 2010-05-19T00:41:50+09:00 Subject: Re: class arrays On Tuesday, May 18, 2010 08:40:08 am poseid wrote: > Hello, > > how does this work? > > >> class A > >> > >> b = [1, 2,3] > >> > >> end > > => [1, 2, 3] > > > > Is b an instance variable? class variable? Nope. It's a local variable. That means it disappears as soon as the interpreter hits that 'end' statement. > how would I access b from > outside the class? You could create a class variable, but I'd recommend an instance variable on the class instead: class A class << self attr_accessor :b end self.b = [1, 2, 3] end p A.b