I am trying to build a library of pull parser based mixins for
LibXML::XML::Reader and rexml/pull_parser but I cannot subclass
LibXML::XML::Reader and get this mixins included.  How can I do this without
reopening LibXML::XML::Reader?

for instance: this doesn't work

require 'libxml'

module Helpers

  def testing
    'this should work'
  end

end

class SimpleReader < LibXML::XML::Reader

  include Helpers

end

if $0 == __FILE__

  reader = SimpleReader.string('<testing><node></node></testing')
  puts reader.testing
end

>> C:\Documents and Settings\dominic e sisneros\My
Documents\programming\ruby\simple_reader\spec>ruby include_test.rb
include_test.rb:21: undefined method `testing' for
#<LibXML::XML::Reader:0x2dfb2c0> (NoMethodError)

but if I do

module LibXML
 module XML
   class Reader
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to