I’d like to push these upstream, hopefully to the JSON gem. I’m also thinking about adding support to perform patches while streaming so that a patch can be applied to a target document without having the entire patch loaded in memory all at the same time.
I want to specifically call out one part of the implementation because it makes me lol. The patch spec has a bunch of commands like add, remove, etc. These commands are in a hash along with other values. I wanted to dispatch to a method for handling each command. If you sort the keys alphabetically, the command to perform is always first. You can see the dispatch here. TEE HEE!