I love the dark corners of Ruby. Today we discovered this one by basically guessing that it might work:
def foos(foo, bar = foo.upcase + "!") puts foo puts bar end
2.3.1 :001 > foos('foo') foo FOO! => nil
bar references another argument,
foo. And we can also call a method on it. And concatenate it with a string, because, why not? The ‘principle of least surprise’ strikes again.
h/t Brian DunnTweet