summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/amqpgen.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/rubygen/amqpgen.rb')
-rwxr-xr-xqpid/cpp/rubygen/amqpgen.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/qpid/cpp/rubygen/amqpgen.rb b/qpid/cpp/rubygen/amqpgen.rb
index b1e635a27b..b95a507b5e 100755
--- a/qpid/cpp/rubygen/amqpgen.rb
+++ b/qpid/cpp/rubygen/amqpgen.rb
@@ -356,13 +356,19 @@ class AmqpRoot < AmqpElement
amqp_attr_reader :major, :minor, :port, :comment
amqp_child_reader :doc, :type, :struct, :domain, :constant, :class
- def parse(filename) Document.new(File.new(filename)).root; end
+ def get_root(x)
+ case x
+ when Element then x
+ when Document then x.root
+ else Document.new(x).root
+ end
+ end
# Initialize with output directory and spec files from ARGV.
def initialize(*specs)
raise "No XML spec files." if specs.empty?
- xml=parse(specs.shift)
- specs.each { |s| xml_merge(xml, parse(s)) }
+ xml=get_root(specs.shift)
+ specs.each { |s| xml_merge(xml, get_root(s)) }
@used_by=Hash.new{ |h,k| h[k]=[] }
super(xml, nil)
end