---2049402039-982185925-1169770884=:24160
Content-Type: MULTIPART/MIXED; BOUNDARY="-2049402039-982185925-1169770884=:24160"
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
---2049402039-982185925-1169770884=:24160
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
Hi --
Alle 01:02, venerd=C3=AC 26 gennaio 2007, Neville Franks ha scritto:
def size=3D(val) is simply the definition of a method called size=3D, whi= ch
accepts the parameter val. It's the ruby way of allowing write access to = an
instance variable.
I'd put a slightly different spin on it. Ruby lets you put a final =3D
on method names, and gives you the nice calling syntax:
obj.x =3D 1 # prettified version of obj.x=3D(1)
The existence of the =3D-methods doesn't pertain directly to instance
variables. You could write:
def call_me_ishmael
@name =3D "Ishmael"
end
and you could also write:
def name=3D(name)
puts "You can't name me!"
end
and so on.
Lots of =3D-methods (including all of those created with attr_writer)
involve writing to instance variables; but that's a conventioned
layered on top of the way it works, rather than being the way it works
itself.
David
--=20
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (
http://www.manning.com/black)
(See what readers are saying!
http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (
http://www.rubypal.com)
---2049402039-982185925-1169770884=:24160--
---2049402039-982185925-1169770884=:24160--