So “@a” refers to (and creates if needed) an instance variable.
Is there some method to get rid of an instance variable (not just set to
nil)?
So “@a” refers to (and creates if needed) an instance variable.
Is there some method to get rid of an instance variable (not just set to
nil)?
[Its Me itsme213@hotmail.com, 2004-03-08 19.54 CET]
So “@a” refers to (and creates if needed) an instance variable.
Is there some method to get rid of an instance variable (not just set to
nil)?
$ ri -T remove_instance_variable
---------------------------------------- Object#remove_instance_variable
obj.remove_instance_variable(symbol) => obj
Removes the named instance variable from _obj_, returning that
variable's value.
class Dummy
attr_reader :var
def initialize
@var = 99
end
def remove
remove_instance_variable(:@var)
end
end
d = Dummy.new
d.var #=> 99
d.remove #=> 99
d.var #=> nil
And can I somehow remove a variable?
Say it is a big array, whatever.
Say this object is defined in C…
Gergo
–
±[ Kontra, Gergelykgergely@mcl.hu PhD student Room IB113 ]---------+
http://www.mcl.hu/~kgergely “Olyan langesz vagyok, hogy |
Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom” |
±- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+
“Gergely Kontra” kgergely@mcl.hu schrieb im Newsbeitrag
news:20040309152533.GH18404@mlabdial.hit.bme.hu…
And can I somehow remove a variable?
Say it is a big array, whatever.
Say this object is defined in C…
If you mean to say “force garbage collection of an instance” then I’d say,
you can’t. And you’re not supposed to either. Ruby’s GC will take
care of that.
Kind regards
robert