Stephane Wirtel wrote:
>
> I don't believe that's possible to assign something to an instance
>
> Best Regards,
>
> Stephane
Stephanie,
In ruby, we don't assign to an instance as you mentioned, we assign to a
variable that can hold any type. We therefore can't override the
assignment operator.
BUT you can override an assignment operation.. such as
class Foo
def bar= (val)
@bar = val
p "I am assigning #{val} to @bar"
end
hth
ilan
--
Posted via
http://www.ruby-forum.com/.