Created
November 20, 2008 19:48
-
-
Save webmat/27156 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#console | |
sudo gem install ruby_parser | |
#irb | |
require 'rubygems' ; require 'ruby_parser' ; require 'pp' | |
pp RubyParser.new.parse "class C | |
def meth(arg) | |
arg * 2 | |
end | |
end" | |
#=> | |
s(:class, | |
:C, | |
nil, | |
s(:scope, | |
s(:defn, | |
:meth, | |
s(:args, :arg), | |
s(:scope, | |
s(:block, | |
s(:return, s(:call, s(:lvar, :arg), :*, s(:arglist, s(:lit, 2))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment