summaryrefslogtreecommitdiff
path: root/cpp/rubygen
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/rubygen')
-rwxr-xr-xcpp/rubygen/amqpgen.rb12
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