3 ms·
Funny, my first thought on reading this was, "why doesn't she just use `&.` and `||` and call it a day" until I realized that it's a syntax error if you try to
by tomc1985 5y ago
Funny, my first thought on reading this was, "why doesn't she just use `&.` and `||` and call it a day" until I realized that it's a syntax error if you try to use that with `.[]`
Note there is also `data[:response][:message] rescue IdentityObject.new` if you don't mind the clumsy exception handler...
Perhaps this is my Perl background showing, but `.fetch` just doesn't feel Ruby-like. Ruby's syntactical terseness around hashes (and regular expressions, with `=~`, `$1`, and friends) is one of my favorite features of the language. If I have to do my hash grabs with a typed word, I might as well be writing Python