1. 9
  1.  

  2. 6

    This is a great example of ruby’s malleability. As an added bonus, you can use the same technique to add support for elixir-esque argument pattern matching as shown in this gem: https://github.com/vizvamitra/patme (of course, it makes the code even slower, but it’s still fun!)

    1. 3

      Wow, that’s cool. I thought I had seen every Ruby trick! But 14x slower means this should be used rarely.

      1. 1

        Isn’t that Ruby’s equivalent to Elixir’s pattern matching?