Diff two Ruby hashes
ruby_hash_diffCompare two Ruby hash literals to identify changed values, added or removed keys, and type changes. Accepts hash strings or raw test output for automated diff analysis.
Instructions
Compare two Ruby hash literals and return exactly what changed: changed values with before/after, added and removed keys, and explicit type changes (nil to String, Integer to Float, symbol vs string keys). Pass either expected and actual as Ruby hash strings, or pass raw failing Minitest/RSpec output in raw and the first two hash literals found will be compared. Much cheaper and more reliable than eyeballing large nested hashes in test output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | Raw failing test output containing two hash literals (lines may be prefixed with - and +) | |
| actual | No | Actual Ruby hash literal, e.g. {"role"=>"editor"} | |
| expected | No | Expected Ruby hash literal, e.g. {"role"=>"admin"} |