An instance variable doesn't get created until it is first assigned. So =
in this case, you
have to call `hello` before @v will show up in =
`self.instance_variables`:

puts self
=3D> main
def hello
@v =3D 1
end
=3D> nil
puts self.instance_variables
=3D> nil
hello
=3D> 1
puts self.instance_variables
=3D> @v
=3D> [:@v]

Michael Edgar
adgar / carboni.ca
http://carboni.ca/

On May 16, 2011, at 8:54 PM, Brian Xue wrote:

> Can anyone help explain?
>=20
> Many thanks!
>=20
> Brian