Example code from my blog post on the flip-flop operator in Ruby