That's kind of funny, I actually just finished building a tool that lets you perform queries against the ruby AST. You can pattern match and process S-Expressions. It still needs a bit of polish, but it's pretty neat.
Check it out, SexpPath: https://github.com/adamsanderson/sexp_path/tree