lib/amqp/protocol.rb in tmm1-amqp-0.5.2 vs lib/amqp/protocol.rb in tmm1-amqp-0.5.3

- old
+ new

@@ -21,10 +21,16 @@ args.shift || opts[name] || opts[name.to_s] instance_variable_set("@#{name}", val) end end + def arguments + self.class.arguments.inject({}) do |hash, (type, name)| + hash.update name => instance_variable_get("@#{name}") + end + end + def to_binary buf = Buffer.new buf.write :short, self.class.parent.id buf.write :short, self.class.id @@ -114,11 +120,11 @@ eql and __send__(field) == header.__send__(field) end end def method_missing meth, *args, &blk - @klass.properties.map{|_,name| name }.include?(meth) ? @properties[meth] : - super + @properties.has_key?(meth) || @klass.properties.find{|_,name| name == meth } ? @properties[meth] : + super end end def self.parse buf buf = Buffer.new(buf) unless buf.is_a? Buffer \ No newline at end of file