Re: How to parse ruby files programmatically
Paul McKibbin <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <[email protected]> |
> On 7 May 2019, at 12:54, Andrey Tuzhilin <[email protected]> wrote: > > Hi! > > I need to parse ruby files (files, containing ruby code) and edit them. Specifically, I need: > > 1. Extract the list of classes defined in file > 2. Without them being applied in current env (if some file for instance contains `String` class method patching, I don’t want it to be patched in current ruby session) > > Is there a way to accomplish this? > > Unsubscribe: <mailto:[email protected]?subject=unsubscribe> > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> Hi, Have you taken a look at RubyParser, SexpProcessor and Ruby2Ruby from the seattlerb. Using these should be a lot easier than trying to generate it with regular expressions. Best wishes, Paul Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>