Search code examples
rubyparsingnokogiris-expression

Is there something similar to Nokogiri for parsing Ruby code?


Nokogiri is awesome. I can do things like #css('.bla') which will return the first matching element.

Right now we need to do some parsing of Ruby source code - finding all methods within a class etc. We're using the ruby_parser gem, but all it does is comb your source code and spit out S-expressions. Is there anything like Nokogiri for these S-expressions which can do things like "return S-expression for first method found named 'foo'"?


Solution

  • The only thing I can think of, is Adam Sanderson's SExpPath library.