3 ms·
Not true, there is special things about them, like always returning their argument.
by yxhuvud 4y ago
Not true, there is special things about them, like always returning their argument.
- byroot 4y agoYou are confusing setters with the assignment evaluation. Setters are just normal methods. ?> def you_are_wrong=(a) ?> a * 2 >> end => :you_are_wrong= >> send(:you_are_wrong=, 24) => 48 However yes, the `foo.bar = 24` expressions translates to `(foo.send(:bar=, 24); 24)`. The reason is so that `foo = bar.baz = 12` works as you expects, it's absolutely not some kind of cruft or black magic.