It's an interesting trick, but for a setter method you really need to use `def cloaking=(value)` instead of overloading the same method. It would help to give a more realistic example for where this technique can be useful.
semiquaver•36m ago
Wow, I wrote Ruby for 15+ years and never saw this trick!
koolba•7m ago
What happens if you pass in (nothing_provided = true) as the value?
Does it return back the empty current value?
I’m no ruby expert, but seems like the freeze approach avoids that with a unique inaccessible object.
matharmin•45m ago