// the find
tenderlove/hana
An implementation of JSON Patch and JSON Pointer for Ruby
hana is a small Ruby gem that implements RFC 6902 (JSON Patch) and RFC 6901 (JSON Pointer). You parse JSON into Ruby hashes and arrays, build a Hana::Patch from the operation list, and apply it to the object. It suits Ruby services that already hold their data as Ruby objects and need to apply patch documents to it.
The test suite runs the shared json-patch-tests conformance fixtures as a git submodule, so the implementation is checked against cases written by other people, not only the author's own examples. The library is a single lib/hana.rb file, so reading the whole implementation against the RFC is a short job. The API is small: Hana::Patch.new takes an array of operation hashes and apply takes the target, with nothing to learn beyond the RFC.
The last push was August 2024, and nothing in the repo suggests maintenance since. Treat it as a finished but frozen dependency and check the open issues for RFC edge cases before adopting it. The README is thin: it documents no error types and does not say what apply does on a failed test op or a missing path, so you will need to read lib/hana.rb to find out. The conformance fixtures sit in a submodule that a plain clone does not fetch, so a fresh checkout runs only the hand-written tests until you run git submodule update. Everything works on fully parsed Ruby objects, so patching a large document means parsing and re-serialising all of it, with no streaming and no in-place patching of raw JSON text.