Closed HenryKeiter closed 5 years ago
I'm more in favor of throwing an error in that situation. "allow_phi! does not accept blocks! Please use allow_phi"
I agree, I think that the !
methods and blocks should have a different syntax as bang represents a mutation that could affect multiple objects.
I don't think there's any reason to name the block-syntax method (
allow_phi
) differently from the standard use (allow_phi!
). We can simply check for the existence of a block at the top. This would reduce the likelihood of doing the wrong thing by accidentally calling the wrong method.For example, the following is currently perfectly good-looking code:
The issue is...
The block here is never run, because I accidentally used the bang method, which doesn't support blocks. :man_facepalming: