From: James French Date: 2009-11-06T22:50:30+09:00 Subject: encapsulation issue --_000_950618E0D00138499BE7CC487EBF646D65F38CD3E1WOODCHUCKNMlo_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Is there any way of providing read only access to an array? (problem shown = by code below). class A def initialize @dependencies =3D [] end # intended to be read only access def dependencies @dependencies end def addDependency(d) @dependencies << d puts "adding #{d}" end end a =3D A.new a.addDependency("foo") a.dependencies << "bar" # encapsulation subverted puts a.dependencies # foo and bar both in array Any suggestions appreciated, James --_000_950618E0D00138499BE7CC487EBF646D65F38CD3E1WOODCHUCKNMlo_--