Subclassing question

I’m trying to subclass Ncurses::WINDOW but it just seems to hijack my
class. My subclass’ initialize never gets called. I can’t add any new
methods.

cat test

#!/usr/bin/ruby
begin
require ‘rubygems’
rescue LoadError
ensure
require ‘ncurses’
end

class MyClass < Ncurses::WINDOW

def initialize(arbstring)
puts lkjlkdsf # this should generate an error
end

end

Ncurses.initscr

begin
foo = MyClass.new(10,10,0,0)
ensure
Ncurses.endwin
end

puts foo.class # this should return MyClass

./test

=> Ncurses::Window

Two things wrong.
-initialize never gets called. If it did “puts lkjlkdsf” would generate
an
error.

-“puts foo.class” returns Ncurses::WINDOW where I would expect MyClass.

As a side note, Ncurses::WINDOW doesn’t even exist until Ncurses.initscr
is
called. Perhaps it’s dynamic nature is getting in the way?

Jason