hi,

I am trying to use some dynamic features of ruby.

Inside my module, I try to add some method dynamicaly but I get an error
when I am trying to.



module Rubyhaviour
  def add(object)
    name = "@" + object.class.downcase

    if self.instance_variable_get(name)
      self.instance_variable_get(name) << object
    else
      self.instance_variable_set(name, Array.new)
      self.instance_variable_get(name) << object

      define_method(name) do
        instance_variable_get("@#{name}")
      end
    end
  end
end
undefined method `define_method' for #<Test:0x2ce631c> (NoMethodError)
-- 
Posted via http://www.ruby-forum.com/.