Created
November 24, 2008 20:01
-
-
Save tenderlove/28576 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
require 'rubygems' | |
require 'parse_tree' | |
require 'ruby2ruby' | |
require 'sexp_processor' | |
require 'ruby_parser' | |
class Codes | |
def super_awesome | |
foo = 10 | |
foo + 10 * 20 | |
end | |
end | |
class RubyMutator < SexpProcessor | |
def rewrite_lvar exp | |
s(:call, exp, :+, s(:lit, 42)) | |
end | |
end | |
codes = ParseTree.new.parse_tree(Codes) | |
puts Ruby2Ruby.new.process(RubyMutator.new.process(codes.first)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment