[open-ils-commits] r814 - acq_edi/trunk/lib/edi (mbklein)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Mar 3 17:01:08 EST 2010
Author: mbklein
Date: 2010-03-03 17:01:02 -0500 (Wed, 03 Mar 2010)
New Revision: 814
Modified:
acq_edi/trunk/lib/edi/edi2json.rb
Log:
Added MsgGroup handling to edi2json
Modified: acq_edi/trunk/lib/edi/edi2json.rb
===================================================================
--- acq_edi/trunk/lib/edi/edi2json.rb 2010-03-03 21:25:53 UTC (rev 813)
+++ acq_edi/trunk/lib/edi/edi2json.rb 2010-03-03 22:01:02 UTC (rev 814)
@@ -31,6 +31,9 @@
end
end
end
+ if (result[child.name].is_a?(Array) or result[child.name].is_a?(Hash)) and result[child.name].empty?
+ result.delete(child.name)
+ end
}
# Segment groups last
@@ -57,7 +60,11 @@
messages = []
self.each { |message|
- messages << {message.name => message.to_hash}
+ if message.is_a?(MsgGroup)
+ messages += message.to_hash
+ else
+ messages << {message.name => message.to_hash}
+ end
}
{
@@ -90,6 +97,14 @@
end
+class MsgGroup
+
+ def to_hash
+ self.collect { |msg| { msg.name => msg.to_hash } }
+ end
+
+end
+
class E::UNA
def to_hash
result = {}
More information about the open-ils-commits
mailing list