I have the following code

class foo
  price_per_liter = 1
  price
  module bar
    def set_price val
      self.price_per_liter = val
    end
  end
end

In this way I can succesfully set the price per liter of the class. How
can I make it dunamically, so I can also set the attribute 'price'?

I tried instance_variable_set(@variable, val), but that doesn't work.
Probably because the variables of the class 'foo' and the module 'bar'
lives independent of each other.

-- 
Posted via http://www.ruby-forum.com/.