Dynamic Modules

Hi,

We can dynamically include a module in a class as…

class A

module B
def method_of_b
end
end

end

a = A.new
a.class.send :include, B

Is there any way to remove the dynamically included module from a class.

sur

On Fri, Nov 10, 2006 at 05:23:14PM +0900, sur max wrote:
} We can dynamically include a module in a class as…
[…]
} a = A.new
} a.class.send :include, B
}
} Is there any way to remove the dynamically included module from a
class.

In short, no. The language does not allow removing mixins any more than
it
allows removing a class’s superclass. Individual methods can be removed,
however, using undef or remove_method.

} sur
–Greg

Thanx Greg !!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs