From: Tobias Reif Date: 2002-01-14T18:38:24+09:00 Subject: Re: MetaRuby : RubySchema.rb howto? Robert Feldt wrote: > Hi Tobias et al, > > FYI, I've played with the following way of specifying pretty-printers for > RubyAst/RubyTerms/RubySchema in Rockit (its got a similar scheme to > Matju's but its not typed; will probably use Matju's scheme in future > versions): > > * You specify PPDoc's by giving a string with slots that can be later > filled in. Slots are given as "#" followed by a number starting at > 0. Example (for a simple if without else-clause etc): > > p1 = PPDoc["if (#0)\n #1\nend"] > p2 = PPDoc["#0 == #1"] > > p2[1,2].to_s #=> "1 == 2" > > p1[p2["a", 1], "puts a\na"].to_s > > gives: > > if (a == 1) > puts a > a > end Looks good. Would the above be the actual usage? Or could I pass RubySchema objects like ClassDef (or "DefClass"?) to the pretty-printer? Tobi -- http://www.pinkjuice.com/