Hi,

I'm trying to understand how to extend Ruby's functionality. The API seems
to be very transparent but I'm not sure if it's fully so. I'm specifically
trying to understand how to subclass a user-defined Ruby class. Does it
require any special treatment or is it handled in the same way as
extending standard classes? Would it be enough to do 
 VALUE cSub = rb_define_class("Sub", rb_eval_string("Super") )?

Any info greatly appreciated.

Robert
feldt / ce.chalmers.se

For example I'd like to try:

class Super
  def initialize(val)
    @a = val
  end
end

# I want to do this in C:
# class Sub<Super
#   def inv
#     1.0/@a
#   end
# end

# And then start ruby eval.rb and do
#  1. ruby> ...Write in the Super class...
#  2. ruby> require Sub
#  3. ruby> t = Sub.new(2.0)
#  4. ruby> t.inv
#     0.5
#     ruby>