If you have a class ‘Thing’
does name of instance variable have to be:
@thing = Thing.new
or is
@widget = Thing.new
O.k. to use?
jet
If you have a class ‘Thing’
does name of instance variable have to be:
@thing = Thing.new
or is
@widget = Thing.new
O.k. to use?
jet
Variables can be named whatever you’d like. Feel free to use
@widget = Thing.new
If you feel that ‘widget’ is a good name.
El Martes, 12 de Enero de 2010, BlueHandTalking
escribió:> O.k. to use?
local_aaa = Thing.new
CONSTANT_BBB = Thing.new
$global_ccc = Thing.new
a_n_y = Thing.new
@attribute_1 = Thing.new
@@class_var2 = Thing.new
any is valid, so any kind of attribute name is also valid.
Again I think you ask this because Rails conventions. If so remember
please
that this is a Ruby maillist, and Rails rules/conventions are not a must
here.
Inaki,
Thanks for the example list.
Actually, I did not ask because it is a Rails thing.
I asked because I needed some fundamental, like very
basic knowledge about Ruby that I did not understand.
…and I did RTFM before this post.
Thanks again,
Jet
On 2010-01-12, BlueHandTalking [email protected] wrote:
O.k. to use?
How far do you think you’d get if you could only use “@fixnum” for
numeric
values used as instance variables?
For that matter, what name would you give to an instance variable that
might, like any other variable in the language, hold different types of
objects in different contexts?
In short, the name is purely up to you.
-s
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs