DEV Community

Discussion on: The Case for Pattern Matching Key Irreverence in Ruby

Collapse
 
baweaver profile image
Brandon Weaver

With how pattern matching works, no, unfortunately. There can't be guarantees the next objects in that Array are all of the same structure or even type, so each subsequent node has either deconstruct or deconstruct_keys called on it.

Now that said you might enjoy jq and the Ruby wrapper around it: github.com/winebarrel/ruby-jq

I've been musing about my own DSL for searching through deeply nested structures because that's always a pain, but haven't experimented too much on it yet.