"GGarramuno" <ggarramuno / aol.com> schrieb im Newsbeitrag
news:20040331173236.20738.00000341 / mb-m19.aol.com...
> >
> >I don't think that's what the OP wanted.  This seems to be more
> >appropriate
>
> Indeed.  remove_method and undef_method is what I want.
>
> Is there a particular reason there's no remove_instance_variable to
match all
> the other remove_ methods of Module?

There is, but it's private:

>> class Foo; attr_accessor :bar; end
=> nil
>> f = Foo.new
=> #<Foo:0x10186cb8>
>> f.bar = "foo"
=> "foo"
>> f
=> #<Foo:0x10186cb8 @bar="foo">
>> f.remove_instance_variable :@bar
NoMethodError: private method `remove_instance_variable' called for
#<Foo:0x10186cb8 @bar="foo">
        from (irb):5
>> class Foo
>>   def rem(sym)
>>     remove_instance_variable sym
>>   end
>> end
=> nil
>> f.rem :@bar
=> "foo"
>> f
=> #<Foo:0x10186cb8>

:-)

    robert