diff options
author | Alan Conway <aconway@apache.org> | 2007-08-03 15:47:44 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-08-03 15:47:44 +0000 |
commit | c5a6f0ab2b49d21d088d448f4fe5c5c5c99ed6ee (patch) | |
tree | 1da5b92a6a0d0eebb4253c5b691497bfd9c9e021 /cpp/rubygen | |
parent | e8a2a5f2b17f851f98d0f2c0aab1c2cef2b0d937 (diff) | |
download | qpid-python-c5a6f0ab2b49d21d088d448f4fe5c5c5c99ed6ee.tar.gz |
Added index() to classes & methods.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@562509 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen')
-rwxr-xr-x | cpp/rubygen/amqpgen.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cpp/rubygen/amqpgen.rb b/cpp/rubygen/amqpgen.rb index 1bd11848a6..0b7cfac5ea 100755 --- a/cpp/rubygen/amqpgen.rb +++ b/cpp/rubygen/amqpgen.rb @@ -76,6 +76,8 @@ end class AmqpMethod < AmqpElement def initialize(xml, amqp) super; end + def index attr["index"]; end + def fields() @cache_fields ||= elements.collect("field") { |f| AmqpField.new(f,self); } end @@ -99,7 +101,7 @@ end # AMQP class element. class AmqpClass < AmqpElement def initialize(xml,amqp) super; end - + def index attr["index"]; end def methods() @cache_methods ||= elements.collect("method") { |el| AmqpMethod.new(el,self) @@ -171,12 +173,16 @@ class Generator end # Create a new file, set @out. - def file(file) + def file(file, &block) puts file if (@outdir != "-") path=Pathname.new "#{@outdir}/#{file}" path.parent.mkpath - path.open('w') { |@out| yield } + if &block + path.open('w') { |@out| yield } + else + path.open('w') + end end end |