Y
yermej
I'm working with libxml and I can't seem to define a subclass of
XML:ocument. For example,
require 'libxml'
class SubDocument < XML:ocument
def initialize(name)
super
@sub_name = name
end
def sub_method
puts "the method"
end
end
As you can see from the above, it's as if I'm aliasing XML:ocument,
rather than subclassing it. I have also tried including XML and then
defining the subclass as well as opening the XML module and then
defining the subclass -- same results in both cases. I've never come
across this before. Is there a way to fix this or should I just write
my class to contain an XML:ocument?
Thanks,
Jeremy
XML:ocument. For example,
require 'libxml'
class SubDocument < XML:ocument
def initialize(name)
super
@sub_name = name
end
def sub_method
puts "the method"
end
end
s = SubDocument.new('test')
=> false=> said:s.respond_to? 'sub_method'
=> XML:ocuments.class
As you can see from the above, it's as if I'm aliasing XML:ocument,
rather than subclassing it. I have also tried including XML and then
defining the subclass as well as opening the XML module and then
defining the subclass -- same results in both cases. I've never come
across this before. Is there a way to fix this or should I just write
my class to contain an XML:ocument?
Thanks,
Jeremy