From: Ben Giddings Date: 2005-02-09T02:52:46+09:00 Subject: Object#to_ruby and Object#to_c In case you missed it, on RedHanded, I spotted was an interesting snippet I didn't see on the list or anything: It's a way of using ParseTree and RubyToC to add 'to_c' and 'to_ruby' methods to any Method. http://redhanded.hobix.com/cult/tooInterestingToPassUp.html (it also kinda shows how difficult it would be to truly obfuscate Ruby source) A teaser: class Example def example(arg1) return "Blah: " + arg1.to_s end end quoting zenspider: Source: e = Example.new puts "sexp:" p e.method(:example).to_sexp puts "C:" puts e.method(:example).to_c puts "Ruby:" puts e.method(:example).to_ruby Output: sexp: [:defn, :example, [:scope, [:block, [:args, :arg1], [:return, [:call, [:str, "Blah: "], :+, [:array, [:call, [:lvar, :arg1], :to_s]]]]]]] C: str example(long arg1) { return strcat("Blah: ", to_s(arg1)); } Ruby: def example(arg1) return "Blah: " + arg1.to_s end Ben