From: Albert Schlef Date: 2010-02-08T07:23:58+09:00 Subject: Re: Symbols and class veriable Jerome David Sallinger wrote: > Hello, Is the any connection between a symbol and a class variable. For > example, if I declare the variable @red_car_speed is this aliased or > connected by :red_car_speed. The section of code that is confuring me > is: > > control_panel do |c| > c.slider :red_car_speed, -5..15 > c.slider :blue_car_speed, -5..15 > end [...] > @red_car_speed = 1 > @blue_car_speed = 2 @something and :something aren't linked. It happens that the slider() method gets the name of a variable whose value it will change as the user interacts with the slider. This technique, of seemingly extending Ruby's syntax, is known as "metaprogramming". -- Posted via http://www.ruby-forum.com/.