S
Schüle Daniel
Hi all,
irb(main):001:0>
irb(main):002:0* class A
irb(main):003:1> def secret;"you found me";end
irb(main):004:1> end
=> nil
irb(main):005:0> class BlackHole
irb(main):006:1> a=A.new
irb(main):007:1> end
=> #<A:0x40224e50>
irb(main):008:0> ObjectSpace.each_object(){|obj| $found=obj if
obj.respond_to? :secret }
=> 5252
irb(main):009:0> $found
=> #<A:0x40224e50>
irb(main):010:0> $found.secret
=> "you found me"
irb(main):011:0>
seemingly a is not dead inside BlackHole
is there a civilized way to get to it? (not through ObjectSpace)
I know Ruby has @@ and @ for variables, everything else are methods
if defined inside a class like in example above
but where do object like a go if defined inside a class?
Regards, Daniel
irb(main):001:0>
irb(main):002:0* class A
irb(main):003:1> def secret;"you found me";end
irb(main):004:1> end
=> nil
irb(main):005:0> class BlackHole
irb(main):006:1> a=A.new
irb(main):007:1> end
=> #<A:0x40224e50>
irb(main):008:0> ObjectSpace.each_object(){|obj| $found=obj if
obj.respond_to? :secret }
=> 5252
irb(main):009:0> $found
=> #<A:0x40224e50>
irb(main):010:0> $found.secret
=> "you found me"
irb(main):011:0>
seemingly a is not dead inside BlackHole
is there a civilized way to get to it? (not through ObjectSpace)
I know Ruby has @@ and @ for variables, everything else are methods
if defined inside a class like in example above
but where do object like a go if defined inside a class?
Regards, Daniel