Hi,

I'd like to get the bytecode of a method in Ruby 1.9. I know that I
can compile a string or file into bytecode with:

   iseq = RubyVM::InstructionSequence.compile_file("name_of_file")

But is there a method which allows me to do access the bytecode
of a method from a running script as shown below:

   class A
     def b
       1 + 2
     end
   end

   iseq = A.bytecode_for_method(:b) # => RubyVM::InstructionSequence

If not, is it possible/hard to implement? I think there should be a
method cache somewhere which contains an instruction pointer to the
start of the method.

I'd love to experiment with translating the bytecode into a different 
language (maybe Javascript), that's why I am ask :)

Regards,

   Michael