J
Jason Wold
------=_Part_21872_29476365.1138558380886
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
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 =3D MyClass.new(10,10,0,0)
ensure
Ncurses.endwin
end
puts foo.class # this should return MyClass
# ./test
=3D> 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
------=_Part_21872_29476365.1138558380886--
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
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 =3D MyClass.new(10,10,0,0)
ensure
Ncurses.endwin
end
puts foo.class # this should return MyClass
# ./test
=3D> 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
------=_Part_21872_29476365.1138558380886--