4 ms·
Or ... you just ignore the rules john.instance_variable_set(:@name, "John Doe") john.send(:"instance_exec") do @name = "John Doe" end I love ruby.
by faebi 4y ago
Or ... you just ignore the rules
john.instance_variable_set(:@name, "John Doe")
john.send(:"instance_exec") do @name = "John Doe" end
I love ruby.
- fknorangesite 4y agoHah, true. But good luck getting it past code review, right?
- JohnBooty 4y agoYeah. Non-Ruby devs are probably thinking, "what is the point of rules if the rules can be sidestepped so easily?" But IMO/IME Ruby strikes a good balance here. You can break the rules but it really sticks out like a sore thumb. We avoid these backdoors like the plague.
- chris12321 4y agoSharp knives and all that