Author: aconway
Date: Fri Aug  3 08:47:44 2007
New Revision: 562509

URL: http://svn.apache.org/viewvc?view=rev&rev=562509
Log:
Added index() to classes & methods.

Modified:
    incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb

Modified: incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb?view=diff&rev=562509&r1=562508&r2=562509
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb Fri Aug  3 08:47:44 2007
@@ -76,6 +76,8 @@
 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 @@
 # 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 @@
   end
 
   # Create a new file, set @out. 
-  def file(file)
+  def file(file, &block)
     puts file                   
     if (@outdir != "-")         
       path=Pathname.new "[EMAIL PROTECTED]/#{file}"
       path.parent.mkpath
-      path.open('w') { |@out| yield }
+      if &block
+        path.open('w') { |@out| yield }
+      else
+       path.open('w')
+      end
     end
   end
 


Reply via email to