Porting code example (Ruby to Elixir)

I had trouble merging somehow. Couldn’t figure out how to resolve conflict manually.

Not sure what state this is in now.