This looks like a bug to me, but I don't know enough about how inheritance is implemented to understand it fully. I have a workaround for now, but it should be better understood, documented, and maybe fixed if it's actually a problem.
class Foo
include OM::XML::Document
set_terminology do |t|
t.root(:path=>"foo")
t.bar
t.barbaz(:ref=>[:bar], :attributes=>{:type=>"baz"})
end
end
Foo.terminology.xpath_for :bar # should be //bar
Foo.terminology.xpath_for :barbaz # should be //bar[@type="baz"]
class FooBar < Foo
extend_terminology do |t|
t.barquux(:ref=>[:bar], :attributes=>{:type=>"quux"})
end
end
FooBar.terminology.xpath_for :bar # should be //bar
FooBar.terminology.xpath_for :barbaz # should be //bar[@type="baz"]
FooBar.terminology.xpath_for :barquux # should be //bar[@type="quux"]
class FooBaz < Foo
extend_terminology do |t|
t.baz
t.bazquux(:ref=>[:baz], :attributes=>{:type=>"quux"})
end
end
FooBaz.terminology.xpath_for :bar # should be //bar
FooBaz.terminology.xpath_for :barbaz # should be //bar[@type="baz"]
FooBaz.terminology.xpath_for :baz # should be //baz
FooBaz.terminology.xpath_for :bazquux # should be //baz[@type="quux"]
# Workaround: Define FooBar and FooBaz again, but with
include OM::XML::Document
use_terminology(Foo)
# before the extend_terminology block
This looks like a bug to me, but I don't know enough about how inheritance is implemented to understand it fully. I have a workaround for now, but it should be better understood, documented, and maybe fixed if it's actually a problem.