Whole class into a text file

Is there any method or idea to get whole class into a text file ?

···

--
Posted via http://www.ruby-forum.com/.

-------- Original-Nachricht --------

Datum: Fri, 26 Oct 2007 16:17:51 +0900
Von: Pokkai Dokkai <bad_good_lion@yahoo.com>
An: ruby-talk@ruby-lang.org
Betreff: whole class into a text file...

Is there any method or idea to get whole class into a text file ?
--
Posted via http://www.ruby-forum.com/\.

Dear Pokkai,

maybe this

http://www.headius.com/rubyspec/index.php/Marshaling

is what you mean.

Best regards,

Axel

···

--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: GMX E-Mail ✉ sichere & kostenlose E-Mail-Adresse ✉

If you are still asking about this:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/273496

Then here is a start:

alexg@alexgdell:~/Desktop$ cat r2r.rb
require 'ruby2ruby'

class Foo
   def bar(a)
     return "foobar"
   end
end

class Class
   def to_ruby
     str = "class #{self}\n"
     self.instance_methods(false).each do |sym|
       str << RubyToRuby.translate(self,sym.to_sym) + "\n"
     end
     str << "end\n"
   end
end

puts Foo.to_ruby

alexg@alexgdell:~/Desktop$ ruby r2r.rb
class Foo
def bar(a)
   return "foobar"
end

Alex Gutteridge

Bioinformatics Center
Kyoto University

···

On 26 Oct 2007, at 16:17, Pokkai Dokkai wrote:

Is there any method or idea to get whole class into a text file ?