Is there an analog to guard in other languages?
https://dlang.org/spec/contracts.html http://docs.racket-lang.org/guide/contracts.html
and here's a library to add it to ruby (i've seen a couple of others floating around): https://egonschiele.github.io/contracts.ruby/